From c6bc93cdbb6d6bf27931f61c88a50eb11d0ff9bb Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Wed, 12 May 2010 17:01:28 -0400 Subject: make apache::debian::module work with a version-specific ensure Currently, the code expects $ensure to be either 'present' or 'absent' when enabling/disabling the concerned module. It does not take into account that other values could be set. Those other values could be 'purged' and any specific version tag. 'purged' must behave similarly to 'absent' (e.g. disable the module) and all other cases ('present' and a version tag) must enable the module. --- manifests/debian/module.pp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'manifests/debian/module.pp') diff --git a/manifests/debian/module.pp b/manifests/debian/module.pp index 19ac7b6..55500ad 100644 --- a/manifests/debian/module.pp +++ b/manifests/debian/module.pp @@ -2,7 +2,7 @@ define apache::debian::module( $ensure = present, $package_name = 'absent' ){ - $modules_dir = "$apache::debian::config_dir/mods" + $modules_dir = "${apache::debian::config_dir}/mods" if ($package_name != 'absent') { package { "${package_name}": @@ -13,7 +13,15 @@ define apache::debian::module( } case $ensure { - 'present' : { + 'absent','purged': { + exec { "/usr/sbin/a2dismod ${name}": + onlyif => "/bin/sh -c '[ -L ${modules_dir}-enabled/${name}.load ] \\ + && [ ${modules_dir}-enabled/${name}.load -ef ${modules_dir}-available/${name}.load ]'", + notify => Service['apache'], + require => Package['apache'], + } + } + default : { exec { "/usr/sbin/a2enmod ${name}": unless => "/bin/sh -c '[ -L ${modules_dir}-enabled/${name}.load ] \\ && [ ${modules_dir}-enabled/${name}.load -ef ${modules_dir}-available/${name}.load ]'", @@ -24,14 +32,6 @@ define apache::debian::module( }, } } - 'absent': { - exec { "/usr/sbin/a2dismod ${name}": - onlyif => "/bin/sh -c '[ -L ${modules_dir}-enabled/${name}.load ] \\ - && [ ${modules_dir}-enabled/${name}.load -ef ${modules_dir}-available/${name}.load ]'", - notify => Service['apache'], - require => Package['apache'], - } - } } } -- cgit v1.2.3