Commit 2b3bd9ba authored by Adam Lewenberg's avatar Adam Lewenberg
Browse files

fix syntax error

parent 2c343dac
# Enable an Apache module.
# Enable an Apache module. Meant to be used with the
# puppetlabs/apache module.
#
# This uses the a2enmod tool provided by Debian to enable a module with its
# configuration. Example:
......@@ -7,13 +8,12 @@
#
# This infrastructure, and therefore this define, is only available on Debian.
define su_apache::module($ensure) {
define su_apache::module(
Enum ['present', 'absent'] $ensure = undef,
) {
if ($::operatingsystem != 'debian') and ($::operatingsystem != 'ubuntu') {
fail("Unsupported su_apache::module operating system ${::operatingsystem}")
}
if !($ensure in [ 'present', 'absent' ]) {
fail("ensure must be present or absent, not $ensure")
}
# Set various local variables to keep the exec readable.
$modsdir = '/etc/apache2/mods-enabled'
......@@ -31,8 +31,8 @@ define su_apache::module($ensure) {
exec { $cmd:
command => $cmd,
path => '/usr/sbin:/usr/bin',
require => Package['apache'],
require => Class['apache'],
unless => "[ $condition ]",
notify => Exec['apache reload'];
notify => Class['apache::service'];
}
}
# Install an Apache site configuration and enable it.
# Install an Apache site configuration and enable it. Meant to be used with the
# puppetlabs/apache module.
#
# This is used for virtual hosts and enables the site with the Apache a2ensite
# tool. Examples:
......@@ -13,9 +14,9 @@
# This infrastructure, and therefore this define, is only available on Debian.
define su_apache::site(
Enum ['present', 'absent'] $ensure = undef,
Optional[String] $source = undef,
Optional[String] $content = undef,
Enum['present', 'absent'] $ensure = undef,
Optional[String] $source = undef,
Optional[String] $content = undef,
) {
if ($::operatingsystem != 'debian') and ($::operatingsystem != 'ubuntu') {
fail("Unsupported apache::site operating system ${::operatingsystem}")
......@@ -40,7 +41,7 @@ define su_apache::site(
ensure => $ensure,
source => $source,
content => $content,
notify => Class['su_apache::service'],
notify => Class['apache::service'],
}
# Enable or disable the site, based on the ensure parameter.
......@@ -49,16 +50,16 @@ define su_apache::site(
command => "a2ensite ${site_id}",
path => '/usr/bin:/usr/sbin',
creates => "/etc/apache2/sites-enabled/${site_id}",
require => [ Class['su_apache'], File[$realname] ],
notify => Class['su_apache::service'],
require => [ Class['apache'], File[$realname] ],
notify => Class['apache::service'],
}
} elsif ($ensure == 'absent') {
exec { "a2dissite ${site_id}":
command => "a2dissite ${site_id}",
unless => "[ ! -e '/etc/apache2/sites-enabled/${site_id}' ]",
path => '/usr/bin:/usr/sbin',
require => Class['su_apache'],
notify => Class['su_apache::service'],
require => Class['apache'],
notify => Class['apache::service'],
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment