Skip to content

Commit

Permalink
Merge pull request #140 from treydock/latest-group
Browse files Browse the repository at this point in the history
Support ensuring all yum group packages are installed
  • Loading branch information
ghoneycutt authored Jan 30, 2020
2 parents b527ee1 + 53dc1d7 commit 7fc2d1f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
10 changes: 9 additions & 1 deletion manifests/group.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#
define yum::group (
Array[String[1]] $install_options = [],
Enum['present', 'installed', 'absent', 'purged'] $ensure = 'present',
Enum['present', 'installed', 'latest', 'absent', 'purged'] $ensure = 'present',
Optional[Integer] $timeout = undef,
) {

Expand All @@ -36,6 +36,14 @@
unless => "yum grouplist 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+\\+'",
timeout => $timeout,
require => Exec["yum-groupinstall-${name}"],
}
}
}

'absent', 'purged': {
Expand Down
9 changes: 9 additions & 0 deletions spec/defines/group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,13 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_exec("yum-groupinstall-#{title}").with_command("yum -y groupinstall 'Core' --enablerepo=epel") }
end

context 'when ensure is set to `latest`' do
let(:title) { 'Core' }
let(:params) { { ensure: 'latest' } }

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_exec("yum-groupinstall-#{title}").with_command("yum -y groupinstall 'Core'") }
it { is_expected.to contain_exec("yum-groupinstall-#{title}-latest").with_command("yum -y groupinstall 'Core'") }
end
end

0 comments on commit 7fc2d1f

Please sign in to comment.