Allow to pass the ceph secret

Allow to pass the ceph secret instead of a keyring file.

Closes-bug: #1548894
Change-Id: I576924ed9595b403171ffc8be8156ab5416b2caa
This commit is contained in:
Mehdi Abaakouk 2016-03-03 10:40:22 +01:00
parent 902758be10
commit eb1ff24688
2 changed files with 5 additions and 3 deletions

View File

@ -244,7 +244,7 @@ function configure_gnocchi {
if is_service_enabled ceph && [[ "$GNOCCHI_STORAGE_BACKEND" = 'ceph' ]] ; then
iniset $GNOCCHI_CONF storage driver ceph
iniset $GNOCCHI_CONF storage ceph_username ${GNOCCHI_CEPH_USER}
iniset $GNOCCHI_CONF storage ceph_keyring ${CEPH_CONF_DIR}/ceph.client.${GNOCCHI_CEPH_USER}.keyring
iniset $GNOCCHI_CONF storage ceph_secret $(awk '/key/{print $3}' ${CEPH_CONF_DIR}/ceph.client.${GNOCCHI_CEPH_USER}.keyring)
elif is_service_enabled swift && [[ "$GNOCCHI_STORAGE_BACKEND" = 'swift' ]] ; then
iniset $GNOCCHI_CONF storage driver swift
iniset $GNOCCHI_CONF storage swift_user gnocchi_swift

View File

@ -47,8 +47,8 @@ OPTS = [
help='Ceph pool name to use.'),
cfg.StrOpt('ceph_username',
help='Ceph username (ie: admin without "client." prefix).'),
cfg.StrOpt('ceph_keyring',
help='Ceph keyring path.'),
cfg.StrOpt('ceph_secret', help='Ceph key', secret=True),
cfg.StrOpt('ceph_keyring', help='Ceph keyring path.'),
cfg.StrOpt('ceph_conffile',
default='/etc/ceph/ceph.conf',
help='Ceph configuration file.'),
@ -63,6 +63,8 @@ class CephStorage(_carbonara.CarbonaraBasedStorage):
options = {}
if conf.ceph_keyring:
options['keyring'] = conf.ceph_keyring
if conf.ceph_secret:
options['key'] = conf.ceph_secret
if not rados:
raise ImportError("No module named 'rados' nor 'cradox'")