Browse Source

Fix missing exception catch in is_admin_available()

This commit adds a missing exception catch in the is_admin_available()
method. When non-locking test accounts are used and no admin creds are
available an InvalidConfiguration exception is raised instead of the
NotImplemented exception raised by the locking test accounts provider.

Partial-Bug: #1296955
Change-Id: Ic7006f6a40ac174e4b6793096fb92957df350d61
changes/21/157921/1
Matthew Treinish 7 years ago
parent
commit
fda3765ff2
  1. 10
      tempest/common/credentials.py

10
tempest/common/credentials.py

@ -15,6 +15,7 @@ from tempest.common import accounts
from tempest.common import cred_provider
from tempest.common import isolated_creds
from tempest import config
from tempest import exceptions
CONF = config.CONF
@ -53,7 +54,16 @@ def is_admin_available():
else:
try:
cred_provider.get_configured_credentials('identity_admin')
# NOTE(mtreinish) This should never be caught because of the if above.
# NotImplementedError is only raised if admin credentials are requested
# and the locking test accounts cred provider is being used.
except NotImplementedError:
is_admin = False
# NOTE(mtreinish): This will be raised by the non-locking accounts
# provider if there aren't admin credentials provided in the config
# file. This exception originates from the auth call to get configured
# credentials
except exceptions.InvalidConfiguration:
is_admin = False
return is_admin
Loading…
Cancel
Save