Commit 75b4ef0c authored by Adam Lewenberg's avatar Adam Lewenberg
Browse files

add parameter to su_apache::module to suppress apache service restart

parent af768b58
Loading
Loading
Loading
Loading
+21 −7
Original line number Diff line number Diff line
@@ -7,9 +7,13 @@
#     su_apache::module { "rewrite": ensure => present }
#
# This infrastructure, and therefore this define, is only available on Debian.
#
# $restart_apache: restart the Apache service. Defaults to true; set to
# false for Docker container builds.

define su_apache::module(
  Enum['present', 'absent'] $ensure         = undef,
  Boolean                   $restart_apache = true,
) {
  if ($::operatingsystem != 'debian') and ($::operatingsystem != 'ubuntu') {
    fail("Unsupported su_apache::module operating system ${::operatingsystem}")
@@ -30,11 +34,21 @@ define su_apache::module(
  }

  # Enable or disable the module using a2enmod or a2dismod.
  if ($restart_apache) {
    # DO an Apache service restart.
    exec { $cmd:
      command => $cmd,
      path    => '/usr/sbin:/usr/bin',
      require => Package['apache'],
      unless  => "[ $condition ]",
      notify  => Exec['su_apache_reload'],
    }
  } else {
    # DON'T do an Apache service restart.
    exec { $cmd:
      command => $cmd,
      path    => '/usr/sbin:/usr/bin',
      require => Package['apache'],
      unless  => "[ $condition ]",
    notify  => Exec['su_apache_reload'];
  }
}