Do not update the container registry if is None

If the variable self.container_registry is None
then it will break, we should handle this error.

This review is related to the LP:
https://bugs.launchpad.net/tripleo/+bug/1730687

Change-Id: I9266e0d143c8caa00cb615d35ac808af168b87f2
Closes-Bug: #1730687
(cherry picked from commit cae27828ec)
This commit is contained in:
Mathieu Bultel 2017-11-07 17:00:17 +01:00 committed by mathieu bultel
parent 643fa47ab1
commit 629fb79719
2 changed files with 8 additions and 4 deletions

View File

@ -76,8 +76,12 @@ class UpdateStackAction(templates.ProcessTemplatesAction):
noop_env['resource_registry'].update(role_env)
update_env.update(noop_env)
template_utils.deep_update(env, update_env)
plan_utils.update_in_env(swift, env, 'parameter_defaults',
self.container_registry['parameter_defaults'])
# Update parameters
parameters = {}
if self.container_registry is not None:
parameters.update(self.container_registry['parameter_defaults'])
plan_utils.update_in_env(swift, env, 'parameter_defaults', parameters)
# process all plan files and create or update a stack
processed_data = super(UpdateStackAction, self).run(context)

View File

@ -99,11 +99,11 @@ class UpdateStackActionTest(base.TestCase):
{'OS::TripleO::DeploymentSteps': 'OS::Heat::None'}}
mock_getenv.return_value = env
fake_registry = {'parameter_defaults': [
fake_registry = {'parameter_defaults':
{'DockerKeystoneImage': '192.168.24.1:8787/'
'keystone-docker:latest',
'DockerHeatApiImage:': '192.168.24.1:8787/'
'heat-api-docker:latest'}]}
'heat-api-docker:latest'}}
update_env.update(fake_registry)
mock_swift.get_object.return_value = ({}, env)
mock_object_client.return_value = mock_swift