Skip empty resource_registry sections

With a test.yaml like the following:
$ cat test.yaml
resource_registry:
  # foo

We fail like this:
$ openstack overcloud deploy --templates -e test.yaml
Started Mistral Workflow tripleo.validations.v1.check_pre_deployment_validations. Execution ID: 46214613-ad5c-4075-85f6-745d88928d2a
Waiting for messages on queue 'f27e1bfa-ad33-404f-847f-4d3b6b8bf335' with no timeout.
Removing the current plan files
Uploading new plan files
Started Mistral Workflow tripleo.plan_management.v1.update_deployment_plan. Execution ID: f4126d36-3566-47c3-8428-a56087ea9d0c
Plan updated.
Processing templates in the directory /tmp/tripleoclient-Z0maJF/tripleo-heat-templates
'NoneType' object has no attribute 'items'
$ echo $?
1

After the fix we get the correct error from mistral and don't need to
guess any longer:
  u'message': u'Failed to run action [action_ex_id=6bdbb294-964d-4bce-8ae4-9608b09723f6, action_cls=\'<class \'mistral.actions.action_factory.DeployStackAction\'>\', attributes=\'{}\', params=\'{u\'skip_deploy_identifier\': False, u\'container\': u\'overcloud\', u\'timeout\': 240}\']
  ERROR: Environment not in valid format: environment has empty section "resource_registry"', u'status': u'FAILED'}

While it would have been nice to actually print the erroneous file
as well, that would require a bigger overhaul, so for the time being
this fix is the simplest and at least gives us some clues as to what
is going wrong.

Change-Id: I2638ab35c6799efa1ac8ccf4bf0dc331f75fae25
Closes-Bug: #1707659
This commit is contained in:
Michele Baldessari 2017-07-31 17:10:55 +02:00
parent 11ad017824
commit c20150c572

View File

@ -265,7 +265,7 @@ class DeployOvercloud(command.Command):
file_prefix = "file://"
if 'resource_registry' in env:
if env.get('resource_registry'):
for name, path in env['resource_registry'].items():
if not isinstance(path, six.string_types):
continue