Skip to content

Commit

Permalink
Merge pull request #762 from jfroche/add-plugin-install-options
Browse files Browse the repository at this point in the history
Install package with options in sensors and disk plugins
  • Loading branch information
bastelfreak authored Mar 27, 2018
2 parents 87dcba5 + a89c47d commit 3ecef72
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
6 changes: 4 additions & 2 deletions manifests/plugin/disk.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
$manage_package = undef,
$package_name = 'collectd-disk',
$udevnameattr = undef,
Optional[Array[String]] $package_install_options = undef
) {

include ::collectd
Expand All @@ -30,8 +31,9 @@

if $_manage_package {
package { 'collectd-disk':
ensure => $ensure_real,
name => $package_name,
ensure => $ensure_real,
name => $package_name,
install_options => $package_install_options,
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion manifests/plugin/sensors.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$sensors = undef,
$ignoreselected = undef,
$interval = undef,
Optional[Array[String]] $package_install_options = undef
) {

include ::collectd
Expand All @@ -15,7 +16,8 @@
if $facts['os']['family'] == 'RedHat' {
if $_manage_package {
package { 'collectd-sensors':
ensure => $ensure,
ensure => $ensure,
install_options => $package_install_options,
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions spec/classes/collectd_plugin_disk_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,20 @@
)
end
end
context ':install_options install package with install options' do
let :params do
{
package_install_options: ['--enablerepo=mycollectd-repo']
}
end

it 'Will install the package with install options' do
is_expected.to contain_package('collectd-disk').with(
ensure: 'present',
install_options: ['--enablerepo=mycollectd-repo']
)
end
end
end
end
end
Expand Down
22 changes: 22 additions & 0 deletions spec/classes/collectd_plugin_sensors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,26 @@
path: '/etc/collectd.d/10-sensors.conf')
end
end

context ':install_options install package with install options' do
let :facts do
{
osfamily: 'RedHat',
collectd_version: '5.4',
operatingsystemmajrelease: '7',
python_dir: '/usr/local/lib/python2.7/dist-packages'
}
end
let :params do
{ ensure: 'present',
install_options: ['--enablerepo=mycollectd-repo'] }
end

it 'Will install the package with install options' do
is_expected.to contain_package('collectd-sensors').with(
ensure: 'present',
install_options: ['--enablerepo=mycollectd-repo']
)
end
end
end

0 comments on commit 3ecef72

Please sign in to comment.