From c1951c379e226f1ee4ea537408c166379d7808ad Mon Sep 17 00:00:00 2001 From: Martin Kopec Date: Wed, 4 Apr 2018 15:03:51 +0000 Subject: [PATCH] Fix failing of listing services Non admin user or a user with no such privileges can't list services. Therefor cinder-backup and metering services can't be discovered for such a user. The patch adds a warning to inform the user. Change-Id: I48119b7a48f49f58dfac7bf34c75a08681b9ae32 --- config_tempest/main.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/config_tempest/main.py b/config_tempest/main.py index 39e2278f..56c11f7f 100755 --- a/config_tempest/main.py +++ b/config_tempest/main.py @@ -512,7 +512,12 @@ def create_tempest_images(client, conf, image_path, allow_creation, def check_ceilometer_service(client, conf, services): - services = client.list_services(**{'type': 'metering'}) + try: + services = client.list_services(**{'type': 'metering'}) + except exceptions.Forbidden: + LOG.warning("User has no permissions to list services - " + "metering service can't be discovered.") + return if services and len(services['services']): metering = services['services'][0] if 'ceilometer' in metering['name'] and metering['enabled']: @@ -524,8 +529,13 @@ def check_volume_backup_service(client, conf, services): if 'volumev3' not in services: LOG.info("No volume service found, skipping backup service check") return - params = {'binary': 'cinder-backup'} - backup_service = client.list_services(**params) + try: + params = {'binary': 'cinder-backup'} + backup_service = client.list_services(**params) + except exceptions.Forbidden: + LOG.warning("User has no permissions to list services - " + "cinder-backup service can't be discovered.") + return if backup_service: # We only set backup to false if the service isn't running otherwise we