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
This commit is contained in:
parent
0fd81db60d
commit
fda3765ff2
|
@ -15,6 +15,7 @@ from tempest.common import accounts
|
||||||
from tempest.common import cred_provider
|
from tempest.common import cred_provider
|
||||||
from tempest.common import isolated_creds
|
from tempest.common import isolated_creds
|
||||||
from tempest import config
|
from tempest import config
|
||||||
|
from tempest import exceptions
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
@ -53,7 +54,16 @@ def is_admin_available():
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
cred_provider.get_configured_credentials('identity_admin')
|
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:
|
except NotImplementedError:
|
||||||
is_admin = False
|
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
|
return is_admin
|
||||||
|
|
Loading…
Reference in New Issue