1 # See README.md for usage information
2 define apache::custom_config (
4 $confdir = $::apache::confd_dir,
8 $verify_command = $::apache::params::verify_command,
12 if $content and $source {
13 fail('Only one of $content and $source can be specified.')
16 if $ensure == 'present' and ! $content and ! $source {
17 fail('One of $content and $source must be specified.')
20 validate_re($ensure, '^(present|absent)$',
21 "${ensure} is not supported for ensure.
22 Allowed values are 'present' and 'absent'.")
24 validate_bool($verify_config)
27 $priority_prefix = "${priority}-"
32 ## Apache include does not always work with spaces in the filename
33 $filename_middle = regsubst($name, ' ', '_', 'G')
34 $filename = "${priority_prefix}${filename_middle}.conf"
36 if ! $verify_config or $ensure == 'absent' {
37 $notifies = Class['Apache::Service']
42 file { "apache_${name}":
44 path => "${confdir}/${filename}",
47 require => Package['httpd'],
51 if $ensure == 'present' and $verify_config {
52 exec { "service notify for ${name}":
53 command => $verify_command,
54 subscribe => File["apache_${name}"],
56 notify => Class['Apache::Service'],
57 before => Exec["remove ${name} if invalid"],
60 exec { "remove ${name} if invalid":
61 command => "/bin/rm ${confdir}/${filename}",
62 unless => $verify_command,
63 subscribe => File["apache_${name}"],