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>
(cherry picked from commit 4aef3d93a5)
This commit is contained in:
Arnaud Morin 2017-04-26 17:21:16 +02:00
parent 5617abf3cf
commit daecab6f35
2 changed files with 33 additions and 17 deletions

View File

@ -21,24 +21,28 @@
# 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.
# accepts latest or specific versions.
# Defaults to present.
# Optional. Desired ensure state of packages.
# accepts latest or specific versions.
# Defaults to present.
#
# [*rados_connect_timeout*]
# Optinal. Timeout value (in seconds) used when connecting
# to ceph cluster. If value <= 0, no timeout is set and
# default librados value is used.
# Default: $::os_service_default.
# Optinal. Timeout value (in seconds) used when connecting
# to ceph cluster. If value <= 0, no timeout is set and
# default librados value is used.
# Default: $::os_service_default.
#
# [*multi_store*]
# (optional) Boolean describing if multiple backends will be configured
# Defaults to false
# [*multi_store*]
# Optional. Boolean describing if multiple backends will be configured
# Defaults to false
#
# [*glare_enabled*]
# (optional) Whether enabled Glance Glare API.
# Defaults to false
# [*glare_enabled*]
# Optional. Whether enabled Glance Glare API.
# Defaults to false
#
class glance::backend::rbd(
$rbd_store_user = $::os_service_default,
@ -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(
}
}
package { 'python-ceph':
ensure => $package_ensure,
name => $::glance::params::pyceph_package_name,
tag => 'glance-support-package',
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