ceph: allow to deploy python-cradox

python-cradox is a new dependency in Gnocchi when deploying Ceph
backend.
RDO team does not want to handle this dependency because it's too
specific to the Ceph backend, so puppet-gnocchi will be able to deploy
it or not (installed by default).

Usage of puppetlabs-stdlib will allow duplicated resource, also using
the tags will allow to modify the resource.
Adding tests & release note.

Change-Id: I110d1080b2dcf362f4e48a773ceef1e87d68b7cd
This commit is contained in:
Emilien Macchi 2016-05-02 09:55:24 -04:00
parent 5fd98dd085
commit b44afcb6cb
3 changed files with 25 additions and 5 deletions

View File

@ -18,6 +18,7 @@ class gnocchi::params {
$gnocchi_wsgi_script_path = '/var/www/cgi-bin/gnocchi'
$gnocchi_wsgi_script_source = '/usr/lib/python2.7/site-packages/gnocchi/rest/app.wsgi'
$pymysql_package_name = undef
$cradox_package_name = 'python2-cradox'
}
'Debian': {
$sqlite_package_name = 'python-pysqlite2'
@ -34,6 +35,7 @@ class gnocchi::params {
$gnocchi_wsgi_script_path = '/usr/lib/cgi-bin/gnocchi'
$gnocchi_wsgi_script_source = '/usr/share/gnocchi-common/app.wsgi'
$pymysql_package_name = 'python-pymysql'
$cradox_package_name = undef
}
default: {
fail("Unsupported osfamily: ${::osfamily} operatingsystem")

View File

@ -40,13 +40,18 @@
# (optional) Ceph configuration file.
# Defaults to '/etc/ceph/ceph.conf'.
#
# [*manage_cradox*]
# (optional) Ensure state of the cradox package.
# Defaults to True.
#
class gnocchi::storage::ceph(
$ceph_username,
$ceph_keyring = $::os_service_default,
$ceph_secret = $::os_service_default,
$ceph_pool = 'gnocchi',
$ceph_conffile = '/etc/ceph/ceph.conf',
) {
$ceph_keyring = $::os_service_default,
$ceph_secret = $::os_service_default,
$ceph_pool = 'gnocchi',
$ceph_conffile = '/etc/ceph/ceph.conf',
$manage_cradox = true,
) inherits gnocchi::params {
if (is_service_default($ceph_keyring) and is_service_default($ceph_secret)) or (! $ceph_keyring and ! $ceph_secret) {
fail('You need to specify either gnocchi::storage::ceph::ceph_keyring or gnocchi::storage::ceph::ceph_secret.')
@ -61,4 +66,13 @@ class gnocchi::storage::ceph(
'storage/ceph_conffile': value => $ceph_conffile;
}
if $manage_cradox {
if $::gnocchi::params::common_package_name {
ensure_packages('python-cradox', {
'ensure' => 'present',
'name' => $::gnocchi::params::cradox_package_name,
'tag' => ['openstack','gnocchi-package'],
})
}
}
}

View File

@ -0,0 +1,4 @@
---
features:
- When deploying Ceph storage backend, allow to automatically install python-cradox
as a packaging dependency.