diff modules/apache/manifests/custom_config.pp @ 257:675c1cc61eaf

Update Apache module to get CentOS 8 support Unfortunately it only fixes some bits. mod_wsgi still needs other approaches This also overrides the vhost modification to make them come last in the import order (after module loading)
author IBBoard <dev@ibboard.co.uk>
date Sun, 22 Dec 2019 14:43:29 -0500
parents 37675581a273
children d9352a684e62
line wrap: on
line diff
--- a/modules/apache/manifests/custom_config.pp	Sun Dec 22 09:41:45 2019 -0500
+++ b/modules/apache/manifests/custom_config.pp	Sun Dec 22 14:43:29 2019 -0500
@@ -7,6 +7,7 @@
   $source         = undef,
   $verify_command = $::apache::params::verify_command,
   $verify_config  = true,
+  $filename       = undef,
 ) {
 
   if $content and $source {
@@ -23,25 +24,29 @@
 
   validate_bool($verify_config)
 
-  if $priority {
-    $priority_prefix = "${priority}-"
+  if $filename {
+    $_filename = $filename
   } else {
-    $priority_prefix = ''
+    if $priority {
+      $priority_prefix = "${priority}-"
+    } else {
+      $priority_prefix = ''
+    }
+
+    ## Apache include does not always work with spaces in the filename
+    $filename_middle = regsubst($name, ' ', '_', 'G')
+    $_filename = "${priority_prefix}${filename_middle}.conf"
   }
 
-  ## Apache include does not always work with spaces in the filename
-  $filename_middle = regsubst($name, ' ', '_', 'G')
-  $filename = "${priority_prefix}${filename_middle}.conf"
-
   if ! $verify_config or $ensure == 'absent' {
-    $notifies = Service['httpd']
+    $notifies = Class['Apache::Service']
   } else {
     $notifies = undef
   }
 
   file { "apache_${name}":
     ensure  => $ensure,
-    path    => "${confdir}/${filename}",
+    path    => "${confdir}/${_filename}",
     content => $content,
     source  => $source,
     require => Package['httpd'],
@@ -49,16 +54,17 @@
   }
 
   if $ensure == 'present' and $verify_config {
-    exec { "service notify for ${name}":
+    exec { "syntax verification for ${name}":
       command     => $verify_command,
       subscribe   => File["apache_${name}"],
       refreshonly => true,
-      notify      => Service['httpd'],
+      notify      => Class['Apache::Service'],
       before      => Exec["remove ${name} if invalid"],
+      require     => Anchor['::apache::modules_set_up'],
     }
 
     exec { "remove ${name} if invalid":
-      command     => "/bin/rm ${confdir}/${filename}",
+      command     => "/bin/rm ${confdir}/${_filename}",
       unless      => $verify_command,
       subscribe   => File["apache_${name}"],
       refreshonly => true,