Fix KeyError in deployment history page
use package name as the service name when service have no name. Change-Id: Ib7585b2c8742dde7c1c0a350db48dee96d1ad0a8 Closes-bug: #1703180
This commit is contained in:
parent
0f21fc1fba
commit
b9ea284b96
|
@ -728,7 +728,7 @@ def get_deployment_history_services(deployment):
|
|||
service_type = service['?']['type']
|
||||
if service_type.find('/') != -1:
|
||||
service_type = service_type[:service_type.find('/')]
|
||||
services[service['name']] = service_type
|
||||
services[service.get('name', service['?']['name'])] = service_type
|
||||
context = {
|
||||
"services": services,
|
||||
}
|
||||
|
|
|
@ -863,8 +863,10 @@ class TestDeploymentHistoryTable(testtools.TestCase):
|
|||
mock.sentinel.rendered_template
|
||||
|
||||
test_description = {'services': [
|
||||
{'name': 'foo_service', '?': {'type': 'foo/bar'}},
|
||||
{'name': 'bar_service', '?': {'type': 'baz/qux'}}
|
||||
{'name': 'foo_service', '?': {'type': 'foo/bar',
|
||||
'name': 'foo_service'}},
|
||||
{'name': 'bar_service', '?': {'type': 'baz/qux',
|
||||
'name': 'bar_service'}}
|
||||
]}
|
||||
mock_deployment = mock.Mock(description=test_description)
|
||||
|
||||
|
|
Loading…
Reference in New Issue