Add parameter to manage packages in rbd backend

Some of us may install python-ceph package with other module.
With this new 'manage_packages' parameter, we can avoid an duplicate
package declaration when it's done in an other part of puppet code.

Default behavior is not changed (package will still be installed).

Change-Id: I75ffa9c3dd05ea31f41b032f4778f967b1c6d974
Signed-off-by: Arnaud Morin <arnaud.morin@corp.ovh.com>
This commit is contained in:
Arnaud Morin 2017-04-26 17:21:16 +02:00
parent 53d268aa8b
commit 4aef3d93a5
2 changed files with 33 additions and 17 deletions

View File

@ -21,8 +21,12 @@
# Optional. Enables direct COW from glance to rbd
# DEPRECATED, use show_image_direct_url in glance::api
#
# [*manage_packages*]
# Optional. Whether we should manage the packages.
# Defaults to true,
#
# [*package_ensure*]
# (optional) Desired ensure state of packages.
# Optional. Desired ensure state of packages.
# accepts latest or specific versions.
# Defaults to present.
#
@ -33,11 +37,11 @@
# Default: $::os_service_default.
#
# [*multi_store*]
# (optional) Boolean describing if multiple backends will be configured
# Optional. Boolean describing if multiple backends will be configured
# Defaults to false
#
# [*glare_enabled*]
# (optional) Whether enabled Glance Glare API.
# Optional. Whether enabled Glance Glare API.
# Defaults to false
#
class glance::backend::rbd(
@ -46,6 +50,7 @@ class glance::backend::rbd(
$rbd_store_pool = $::os_service_default,
$rbd_store_chunk_size = $::os_service_default,
$show_image_direct_url = undef,
$manage_packages = true,
$package_ensure = 'present',
$rados_connect_timeout = $::os_service_default,
$multi_store = false,
@ -84,10 +89,12 @@ class glance::backend::rbd(
}
}
if $manage_packages {
package { 'python-ceph':
ensure => $package_ensure,
name => $::glance::params::pyceph_package_name,
tag => 'glance-support-package',
}
}
}

View File

@ -78,4 +78,13 @@ describe 'glance::backend::rbd' do
)
}
end
describe 'when not managing packages' do
let :params do
{
:manage_packages => false,
}
end
it { is_expected.not_to contain_package('python-ceph') }
end
end