Remove $GNOCCHI_USE_KEYSTONE and check that Keystone is enabled

We just check if Keystone is deployed or not to know if we need to use
it.
We also check that Keystone is enabled before trying to create endpoints
and all.

Change-Id: If728192ed3a0334e837227a0a2ea06203b8b135a
This commit is contained in:
Julien Danjou 2015-09-01 18:40:31 +02:00
parent 234da214ba
commit ceaba3f206
3 changed files with 6 additions and 9 deletions

View File

@ -50,7 +50,6 @@ case $SQL_DRIVER in
;; ;;
esac esac
DEVSTACK_LOCAL_CONFIG+=$'\nexport GNOCCHI_USE_KEYSTONE=False'
export ENABLED_SERVICES export ENABLED_SERVICES
export DEVSTACK_LOCAL_CONFIG export DEVSTACK_LOCAL_CONFIG

View File

@ -55,7 +55,8 @@ function is_gnocchi_enabled {
# gnocchi_swift gnocchi_swift ResellerAdmin (if Swift is enabled) # gnocchi_swift gnocchi_swift ResellerAdmin (if Swift is enabled)
function create_gnocchi_accounts { function create_gnocchi_accounts {
# Gnocchi # Gnocchi
if [[ "$ENABLED_SERVICES" =~ "gnocchi-api" ]]; then if is_service_enabled key && is_service_enabled gnocchi-api
then
create_service_user "gnocchi" create_service_user "gnocchi"
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
@ -231,7 +232,7 @@ function configure_gnocchi {
exit 1 exit 1
fi fi
if [ "$GNOCCHI_USE_KEYSTONE" != "True" ]; then if ! is_service_enabled key; then
iniset $GNOCCHI_CONF api middlewares "" iniset $GNOCCHI_CONF api middlewares ""
else else
inicomment $GNOCCHI_CONF api middlewares inicomment $GNOCCHI_CONF api middlewares
@ -348,12 +349,12 @@ function start_gnocchi {
# Create a default policy # Create a default policy
archive_policy_url="$(gnocchi_service_url)/v1/archive_policy" archive_policy_url="$(gnocchi_service_url)/v1/archive_policy"
if [ "$GNOCCHI_USE_KEYSTONE" == "True" ]; then if is_service_enabled key; then
token=$(openstack token issue -f value -c id) token=$(openstack token issue -f value -c id)
create_archive_policy() { curl -X POST -H "X-Auth-Token: $token" -H "Content-Type: application/json" -d "$1" $archive_policy_url ; } create_archive_policy() { curl -X POST -H "X-Auth-Token: $token" -H "Content-Type: application/json" -d "$1" $archive_policy_url ; }
else else
userid=$(openstack user show admin -f value -c id) userid=`uuidgen`
projectid=$(openstack project show admin -f value -c id) projectid=`uuidgen`
create_archive_policy() { curl -X POST -H "X-ROLES: admin" -H "X-USER-ID: $userid" -H "X-PROJECT-ID: $projectid" -H "Content-Type: application/json" -d "$1" $archive_policy_url ; } create_archive_policy() { curl -X POST -H "X-ROLES: admin" -H "X-USER-ID: $userid" -H "X-PROJECT-ID: $projectid" -H "Content-Type: application/json" -d "$1" $archive_policy_url ; }
fi fi

View File

@ -39,9 +39,6 @@ GNOCCHI_CEPH_POOL=${GNOCCHI_CEPH_POOL:-gnocchi}
GNOCCHI_CEPH_POOL_PG=${GNOCCHI_CEPH_POOL_PG:-8} GNOCCHI_CEPH_POOL_PG=${GNOCCHI_CEPH_POOL_PG:-8}
GNOCCHI_CEPH_POOL_PGP=${GNOCCHI_CEPH_POOL_PGP:-8} GNOCCHI_CEPH_POOL_PGP=${GNOCCHI_CEPH_POOL_PGP:-8}
# Gnocchi with keystone
GNOCCHI_USE_KEYSTONE=${GNOCCHI_USE_KEYSTONE:-True}
# Gnocchi backend # Gnocchi backend
GNOCCHI_STORAGE_BACKEND=${GNOCCHI_STORAGE_BACKEND:-file} GNOCCHI_STORAGE_BACKEND=${GNOCCHI_STORAGE_BACKEND:-file}