Skip to content

Commit 494981f

Browse files
authored
Merge pull request #86 from kuleuven/groupinstall-options
Add optional parameters to groupinstall
2 parents 01fc44f + b68363e commit 494981f

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

README.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,17 @@ yum::versionlock { '0:bash-4.1.2-9.el6_2.*':
303303

304304
### Install or remove *yum* package group
305305

306+
Install yum [package groups](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sec-working_with_package_groups). To list groups: `yum group list`. Then use that name in your puppet manifest. With support for install_options (e.g. enable repos if disabled by default).
307+
306308
```puppet
307309
yum::group { 'X Window System':
308-
ensure => present,
309-
timeout => 600,
310+
ensure => present,
311+
timeout => 600,
312+
install_options => ['--enablerepo=*'];
310313
}
311314
```
312315

316+
313317
### Install or remove packages via `yum install`
314318

315319
This is a workaround for [PUP-3323](https://tickets.puppetlabs.com/browse/PUP-3323). It enables the installation of packages from non-repo sources while still providing dependency resolution. For example, say there is a package *foo* that requires the package *bar*. *bar* is in a Yum repository and *foo* is stored on a stand-alone HTTP server. Using the standard providers for the `Package` resource type, `rpm` and `yum`, the `rpm` provider would be required to install *foo*, because only it can install from a non-repo source, i.e., a URL. However, since the `rpm` provider cannot do dependency resolution, it would fail on its own unless *bar* was already installed. This workaround enables *foo* to be installed without having to define its dependencies in Puppet.

manifests/group.pp

+6-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# [*ensure*] - specifies if package group should be
77
# present (installed) or absent (purged)
88
# [*timeout*] - exec timeout for yum groupinstall command
9+
# [*install_options*] - options provided to yum groupinstall command
910
#
1011
# Actions:
1112
#
@@ -18,9 +19,11 @@
1819
# }
1920
#
2021
define yum::group (
21-
Enum['present', 'installed', 'absent', 'purged'] $ensure = 'present',
22-
Optional[Integer] $timeout = undef,
22+
Array[String[1]] $install_options = [],
23+
Enum['present', 'installed', 'absent', 'purged'] $ensure = 'present',
24+
Optional[Integer] $timeout = undef,
2325
) {
26+
2427
Exec {
2528
path => '/bin:/usr/bin:/sbin:/usr/sbin',
2629
environment => 'LC_ALL=C',
@@ -29,7 +32,7 @@
2932
case $ensure {
3033
'present', 'installed', default: {
3134
exec { "yum-groupinstall-${name}":
32-
command => "yum -y groupinstall '${name}'",
35+
command => join(concat(["yum -y groupinstall '${name}'"], $install_options), ' '),
3336
unless => "yum grouplist hidden '${name}' | egrep -i '^Installed.+Groups:$'",
3437
timeout => $timeout,
3538
}

spec/defines/group_spec.rb

+7
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,11 @@
2323
it { is_expected.to compile.with_all_deps }
2424
it { is_expected.to contain_exec("yum-groupinstall-#{title}").with_timeout(30) }
2525
end
26+
context 'with an install option specified' do
27+
let(:title) { 'Core' }
28+
let(:params) { { install_options: ['--enablerepo=epel'] } }
29+
30+
it { is_expected.to compile.with_all_deps }
31+
it { is_expected.to contain_exec("yum-groupinstall-#{title}").with_command("yum -y groupinstall 'Core' --enablerepo=epel") }
32+
end
2633
end

0 commit comments

Comments
 (0)