From aa95bc6bbc0a2c96f70c27ad45da84034ca6b17b Mon Sep 17 00:00:00 2001 From: m3n3pm Date: Fri, 27 Dec 2024 15:48:01 -0800 Subject: [PATCH 1/5] Handle changes in package group definitions. --- manifests/group.pp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/group.pp b/manifests/group.pp index 2a4f7c6c..17d529f8 100644 --- a/manifests/group.pp +++ b/manifests/group.pp @@ -23,14 +23,14 @@ case $ensure { 'present', 'installed', default: { exec { "yum-groupinstall-${name}": - command => join(concat(["yum -y groupinstall '${name}'"], $install_options), ' '), - unless => "yum grouplist hidden '${name}' | egrep -i '^Installed.+Groups:$'", + command => join(concat(["yum -y group install '${name}'"], $install_options), ' '), + unless => "yum group list hidden '${name}' | egrep -i '^Installed.+Groups:$'", timeout => $timeout, } if $ensure == 'latest' { exec { "yum-groupinstall-${name}-latest": - command => join(concat(["yum -y groupinstall '${name}'"], $install_options), ' '), - onlyif => "yum groupinfo '${name}' | egrep '\\s+\\+'", + command => join(concat(["yum -y group install '${name}'"], $install_options), ' '), + unless => 'test $(yum --assumeno group install DVT-Full 2>/dev/null| grep -c "^Install.*Package\|^Upgrade.*Package") -eq 0', timeout => $timeout, require => Exec["yum-groupinstall-${name}"], } From 38cd19818506e20a280b3ddce69645449f45bf6a Mon Sep 17 00:00:00 2001 From: m3n3pm Date: Mon, 30 Dec 2024 07:34:02 -0800 Subject: [PATCH 2/5] -fix quotation and remove static value from testing. --- manifests/group.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/group.pp b/manifests/group.pp index 17d529f8..0a5e1293 100644 --- a/manifests/group.pp +++ b/manifests/group.pp @@ -30,7 +30,7 @@ if $ensure == 'latest' { exec { "yum-groupinstall-${name}-latest": command => join(concat(["yum -y group install '${name}'"], $install_options), ' '), - unless => 'test $(yum --assumeno group install DVT-Full 2>/dev/null| grep -c "^Install.*Package\|^Upgrade.*Package") -eq 0', + 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}"], } From f6616e75b3a365a60d8d883f333ead3f89142985 Mon Sep 17 00:00:00 2001 From: m3n3pm Date: Mon, 30 Dec 2024 09:51:07 -0800 Subject: [PATCH 3/5] -fix logic for ensure => present and missing packages. --- manifests/group.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/group.pp b/manifests/group.pp index 0a5e1293..c858bc71 100644 --- a/manifests/group.pp +++ b/manifests/group.pp @@ -24,7 +24,7 @@ 'present', 'installed', default: { exec { "yum-groupinstall-${name}": command => join(concat(["yum -y group install '${name}'"], $install_options), ' '), - unless => "yum group list hidden '${name}' | egrep -i '^Installed.+Groups:$'", + unless => "test $(yum --assumeno group install '${name}' 2>/dev/null| grep -c '^Install.*Package') -eq 0", timeout => $timeout, } if $ensure == 'latest' { From 7bc0a94bf1ba09a6114d52d3d06a9527cb54d23e Mon Sep 17 00:00:00 2001 From: m3n3pm Date: Mon, 30 Dec 2024 13:53:44 -0800 Subject: [PATCH 4/5] -preserve original behavior for "ensure => present" (default behavior). --- manifests/group.pp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/manifests/group.pp b/manifests/group.pp index c858bc71..cf9dc313 100644 --- a/manifests/group.pp +++ b/manifests/group.pp @@ -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}'", From 4b8822be03217a12e9e5560dc257649f0fe7d420 Mon Sep 17 00:00:00 2001 From: m3n3pm Date: Thu, 9 Jan 2025 12:12:57 -0800 Subject: [PATCH 5/5] -remove require (not needed) -bugfix regex --- manifests/group.pp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/manifests/group.pp b/manifests/group.pp index cf9dc313..7a89ffb3 100644 --- a/manifests/group.pp +++ b/manifests/group.pp @@ -36,11 +36,10 @@ } } 'latest': { # install the yum group and update if any packages are out of date. - exec { "yum-groupinstall-${name}-latest": + 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\|^Upgrade.*Package') -eq 0", + unless => "test $(yum --assumeno group install '${name}' 2>/dev/null| grep -c -e '^Install.*Package' -e '^Upgrade.*Package') -eq 0", timeout => $timeout, - require => Exec["yum-groupinstall-${name}"], } } 'absent', 'purged': {