From 31fa3345f5117a806d0c0a7fbfd5e6395e21b604 Mon Sep 17 00:00:00 2001
From: Thomas Bellman <bellman@nsc.liu.se>
Date: Wed, 18 Mar 2020 09:10:32 +0100
Subject: [PATCH] Make mod_* classes parametrized.

Add parameters $options and $directives to the mod_ssl, mod_perl and
mod_wsgi classes.  This allows users to specify options and directives
to the modules without having to introduce extra classes inheriting
our mod_* classes and overriding the apache::module::globalconfig
declarations we have.

This seems to be somewhat more in line with current thinking in the
Puppet community as well.
---
 manifests/mod_perl.pp | 6 +++---
 manifests/mod_ssl.pp  | 6 +++---
 manifests/mod_wsgi.pp | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/manifests/mod_perl.pp b/manifests/mod_perl.pp
index 7759edf..27ddfa2 100644
--- a/manifests/mod_perl.pp
+++ b/manifests/mod_perl.pp
@@ -5,7 +5,7 @@
 /*
  * Install the Apache mod_perl module.
  */
-class apache::mod_perl
+class apache::mod_perl($options={}, $directives=[])
 {
     include apache
 
@@ -23,9 +23,9 @@ class apache::mod_perl
     apache::module::globalconfig {
 	'perl':
 	    loadmodule => 'perl_module modules/mod_perl.so',
-	    directives => [],
+	    directives => $directives,
 	    defaultoptions => $default_options,
-	    options => { },
+	    options => $options,
 	    require => Package['mod_perl'];
     }
 }
diff --git a/manifests/mod_ssl.pp b/manifests/mod_ssl.pp
index 2f337de..73a6509 100644
--- a/manifests/mod_ssl.pp
+++ b/manifests/mod_ssl.pp
@@ -7,7 +7,7 @@
  * Note that unlike the ssl.conf that comes with the normal mod_ssl
  * package, we do not add a 'Listen 443' directive.
  */
-class apache::mod_ssl
+class apache::mod_ssl($options={}, $directives=[])
 {
     include apache
 
@@ -33,9 +33,9 @@ class apache::mod_ssl
     apache::module::globalconfig {
 	'ssl':
 	    loadmodule => 'ssl_module modules/mod_ssl.so',
-	    directives => [],
+	    directives => $directives,
 	    defaultoptions => $default_options,
-	    options => { },
+	    options => $options,
 	    require => Package['mod_ssl'];
     }
 }
diff --git a/manifests/mod_wsgi.pp b/manifests/mod_wsgi.pp
index 020c28c..1c82b84 100644
--- a/manifests/mod_wsgi.pp
+++ b/manifests/mod_wsgi.pp
@@ -5,7 +5,7 @@
 /*
  * Install the Apache mod_wsgi module for running Python WSGI applications.
  */
-class apache::mod_wsgi
+class apache::mod_wsgi($options={}, $directives=[])
 {
     include apache
 
@@ -22,9 +22,9 @@ class apache::mod_wsgi
     apache::module::globalconfig {
 	'wsgi':
 	    loadmodule => 'wsgi_module modules/mod_wsgi.so',
-	    directives => [],
+	    directives => $directives,
 	    defaultoptions => $default_options,
-	    options => { },
+	    options => $options,
 	    require => Package['mod_wsgi'];
     }
 }
-- 
GitLab