Fixes various Cfapi bugs.
Currently, murano.cfapi.cfapi throws 2 bugs, when certain branches are reached. 1) An AttributeError is thrown by _get_muranoclient, because CONF.cfapi is accessed; however, cfapi is not a defined group in murano.common.conf. The group should instead be CONF.engine, where packages_service is located. 2) A NameError can be thrown by get_last_operation, in the unlikely situation when m_environment.status is not contained in any of the cases enumerated in the if/elif branches; when this happens, 'resp' is returned without being defined, resulting in this error. 3) Not a bug per se, but a LOG.warning statement is not formatted correctly in get_last_operation. It does not specify the instance_id in the error message. Change-Id: If91a0f8f700a9c0cda0ea85a1d37938f5ef8f98c Closes-Bug: #1661065
This commit is contained in:
parent
caf52b7cec
commit
1e9a625f9c
@ -269,7 +269,8 @@ class Controller(object):
|
||||
# NOTE(freerunner): Prevent code 500 if requested environment
|
||||
# already doesn't exist.
|
||||
if not service:
|
||||
LOG.warning(_LW('Requested service for instance {} is not found'))
|
||||
LOG.warning(_LW('Requested service for instance {0} is not found')
|
||||
.format(instance_id))
|
||||
body = {}
|
||||
resp = response.Response(status=410, json_body=body)
|
||||
return resp
|
||||
@ -280,6 +281,8 @@ class Controller(object):
|
||||
# NOTE(starodubcevna): we can track only environment status. it's
|
||||
# murano API limitation.
|
||||
m_environment = m_cli.environments.get(env_id)
|
||||
body = {'state': 'unknown', 'description': 'operation unknown'}
|
||||
resp = response.Response(status=500, json_body=body)
|
||||
if m_environment.status == 'ready':
|
||||
body = {'state': 'succeeded',
|
||||
'description': 'operation succeed'}
|
||||
@ -299,7 +302,7 @@ class Controller(object):
|
||||
def _get_muranoclient(token_id, req):
|
||||
|
||||
artifacts_client = None
|
||||
if CONF.cfapi.packages_service in ['glance', 'glare']:
|
||||
if CONF.engine.packages_service in ['glance', 'glare']:
|
||||
artifacts_client = _get_glareclient(token_id, req)
|
||||
|
||||
murano_url = CONF.murano.url or req.endpoints.get('murano')
|
||||
|
Loading…
x
Reference in New Issue
Block a user