Skip to content

Commit

Permalink
-preserve original behavior for "ensure => present" (default behavior).
Browse files Browse the repository at this point in the history
  • Loading branch information
jbagleyjr committed Dec 30, 2024
1 parent f6616e7 commit 7bc0a94
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions manifests/group.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,28 @@
}

case $ensure {
'present', 'installed', default: {
'present', default: { # just install the yum group and ensure the group is present.
exec { "yum-groupinstall-${name}":
command => join(concat(["yum -y group install '${name}'"], $install_options), ' '),
unless => "yum grouplist hidden '${name}' | egrep -i '^Installed.+Groups:$'",
timeout => $timeout,
}
}
'installed': { # install the yum group and re-install if any packages are missing.
exec { "yum-groupinstall-${name}":
command => join(concat(["yum -y group install '${name}'"], $install_options), ' '),
unless => "test $(yum --assumeno group install '${name}' 2>/dev/null| grep -c '^Install.*Package') -eq 0",
timeout => $timeout,
}
if $ensure == 'latest' {
exec { "yum-groupinstall-${name}-latest":
command => join(concat(["yum -y group install '${name}'"], $install_options), ' '),
unless => "test $(yum --assumeno group install '${name}' 2>/dev/null| grep -c '^Install.*Package\|^Upgrade.*Package') -eq 0",
timeout => $timeout,
require => Exec["yum-groupinstall-${name}"],
}
}
'latest': { # install the yum group and update if any packages are out of date.
exec { "yum-groupinstall-${name}-latest":
command => join(concat(["yum -y group install '${name}'"], $install_options), ' '),
unless => "test $(yum --assumeno group install '${name}' 2>/dev/null| grep -c '^Install.*Package\|^Upgrade.*Package') -eq 0",
timeout => $timeout,
require => Exec["yum-groupinstall-${name}"],
}
}

'absent', 'purged': {
exec { "yum-groupremove-${name}":
command => "yum -y groupremove '${name}'",
Expand Down

0 comments on commit 7bc0a94

Please sign in to comment.