Fix exception in log warning when no cloud config exists
A recent patch added a more descriptive log message, which is great. Unfortunately, config is not guaranteed in this case to have a cloud key, so just accessing it with config['cloud'] throws an exception, which in turn breaks a test in python-openstackclient. Expand the code a little bit to log the warning differently depending on whether or not cloud exists and has a value. Change-Id: I6b058b3c48a6018b1fe8084344f370530d730d25
This commit is contained in:
parent
471d7382fb
commit
f0837dbb27
|
@ -94,9 +94,15 @@ class OSC_Config(config.OpenStackConfig):
|
|||
]
|
||||
for prop in domain_props:
|
||||
if config['auth'].pop(prop, None) is not None:
|
||||
LOG.warning("Ignoring domain related config %s for %s"
|
||||
"because identity API version is 2.0" %
|
||||
(prop, config['cloud']))
|
||||
if config.get('cloud'):
|
||||
LOG.warning(
|
||||
"Ignoring domain related config %s for %s"
|
||||
"because identity API version is 2.0" % (
|
||||
prop, config['cloud']))
|
||||
else:
|
||||
LOG.warning(
|
||||
"Ignoring domain related config %s because"
|
||||
" identity API version is 2.0" % prop)
|
||||
return config
|
||||
|
||||
def _auth_default_domain(self, config):
|
||||
|
|
Loading…
Reference in New Issue