Skip to content

Commit

Permalink
Merge pull request #478 from amateo/fix_mod_ensure
Browse files Browse the repository at this point in the history
Remove config when module is ensured to absent
  • Loading branch information
bastelfreak authored Oct 6, 2018
2 parents 8a567f4 + 5895a6e commit 6e74026
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions manifests/extension/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -90,33 +90,39 @@
}

$config_root_ini = pick_default($php::config_root_ini, $php::params::config_root_ini)
::php::config { $title:
file => "${config_root_ini}/${ini_prefix}${ini_name}.ini",
config => $final_settings,
}
if $ensure == 'present' or $ensure == 'installed' {
::php::config { $title:
file => "${config_root_ini}/${ini_prefix}${ini_name}.ini",
config => $final_settings,
}

# Ubuntu/Debian systems use the mods-available folder. We need to enable
# settings files ourselves with php5enmod command.
$ext_tool_enable = pick_default($php::ext_tool_enable, $php::params::ext_tool_enable)
$ext_tool_query = pick_default($php::ext_tool_query, $php::params::ext_tool_query)
$ext_tool_enabled = pick_default($php::ext_tool_enabled, $php::params::ext_tool_enabled)
# Ubuntu/Debian systems use the mods-available folder. We need to enable
# settings files ourselves with php5enmod command.
$ext_tool_enable = pick_default($php::ext_tool_enable, $php::params::ext_tool_enable)
$ext_tool_query = pick_default($php::ext_tool_query, $php::params::ext_tool_query)
$ext_tool_enabled = pick_default($php::ext_tool_enabled, $php::params::ext_tool_enabled)

if $facts['os']['family'] == 'Debian' and $ext_tool_enabled {
$cmd = "${ext_tool_enable} -s ${sapi} ${so_name}"
if $facts['os']['family'] == 'Debian' and $ext_tool_enabled {
$cmd = "${ext_tool_enable} -s ${sapi} ${so_name}"

$_sapi = $sapi? {
'ALL' => 'cli',
default => $sapi,
}
if has_key($final_settings, 'extension') and $final_settings[extension] {
exec { $cmd:
onlyif => "${ext_tool_query} -s ${_sapi} -m ${so_name} | /bin/grep 'No module matches ${so_name}'",
require => ::Php::Config[$title],
$_sapi = $sapi? {
'ALL' => 'cli',
default => $sapi,
}
if has_key($final_settings, 'extension') and $final_settings[extension] {
exec { $cmd:
onlyif => "${ext_tool_query} -s ${_sapi} -m ${so_name} | /bin/grep 'No module matches ${so_name}'",
require => ::Php::Config[$title],
}

if $php::fpm {
Package[$php::fpm::package] ~> Exec[$cmd]
if $php::fpm {
Package[$php::fpm::package] ~> Exec[$cmd]
}
}
}
} else {
file {"${config_root_ini}/${ini_prefix}${ini_name}.ini":
ensure => 'absent',
}
}
}

0 comments on commit 6e74026

Please sign in to comment.