Bug 1504052 - Exception should be handled when resources are mapped to non-existent paths in the templates
Summary: Exception should be handled when resources are mapped to non-existent paths i...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-tripleo-common
Version: 12.0 (Pike)
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: z3
: 12.0 (Pike)
Assignee: Rabi Mishra
QA Contact: Ronnie Rasouli
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-10-19 11:59 UTC by Udi Kalifon
Modified: 2023-09-07 18:58 UTC (History)
11 users (show)

Fixed In Version: openstack-tripleo-common-7.6.13-1.el7ost
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-08-20 12:58:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
OpenStack gerrit 519962 0 None MERGED Raise stored HTTPError when fetching swift object 2020-09-16 05:45:18 UTC
Red Hat Issue Tracker OSP-17118 0 None None None 2022-07-09 11:15:12 UTC
Red Hat Product Errata RHSA-2018:2331 0 None None None 2018-08-20 12:59:12 UTC

Description Udi Kalifon 2017-10-19 11:59:20 UTC
Description of problem:
I uploaded to the swift container a new environments/ssl/enable-tls.yaml file, which had the following mapping in it:

resource_registry:
  OS::TripleO::NodeTLSData: ../puppet/extraconfig/tls/tls-cert-inject.yaml

The relative path was not correct because it should have started with "../../" and not just "../" :)

When trying to deploy the plan from the GUI the result was this error:
Failed to run action [action_ex_id=300a4b16-da1f-45d3-a676-9ba9567250e2, action_cls='<class 'mistral.actions.action_factory.DeployStackAction'>', attributes='{}', params='{u'skip_deploy_identifier': False, u'container': u'netisossl', u'timeout': 240}'] ERROR: resources.Controller<nested_stack>.resources.0<https://<<server>>:13808/v1/AUTH_45f6383d2d81450fae5b64dd35a1da32/netisossl/puppet/controller-role.yaml>: : The template is not a JSON object or YAML mapping.

In the Mistral executor log you see this exception:
2017-10-19 13:15:45.784 1775 ERROR mistral.executors.default_executor [req-35266ae4-6978-438c-9b5b-d0cfee75321d ddbc2ea1b0454d499ef13bfb9f981f90 45f6383d2d81450fae5b64dd35a1da32 - default default] Failed to run action [action_ex_id=None, action_cls='<class 'mistral.actions.action_factory.GetFlattenedParametersAction'>', attributes='{}', params='{u'container': u'netisossl'}']
 ERROR: The template is not a JSON object or YAML mapping.: HTTPBadRequest: ERROR: The template is not a JSON object or YAML mapping.
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/mistral/executors/default_executor.py", line 109, in run_action
    result = action.run(context.ctx())
  File "/usr/lib/python2.7/site-packages/tripleo_common/actions/parameters.py", line 414, in run
    processed_data = super(GetFlattenedParametersAction, self).run(context)
  File "/usr/lib/python2.7/site-packages/tripleo_common/actions/parameters.py", line 79, in run
    'heat_resource_tree': heat.stacks.validate(**fields),
  File "/usr/lib/python2.7/site-packages/heatclient/v1/stacks.py", line 332, in validate
    resp = self.client.post(url, **args)
  File "/usr/lib/python2.7/site-packages/heatclient/common/http.py", line 289, in post
    return self.client_request("POST", url, **kwargs)
  File "/usr/lib/python2.7/site-packages/heatclient/common/http.py", line 279, in client_request
    resp, body = self.json_request(method, url, **kwargs)
  File "/usr/lib/python2.7/site-packages/heatclient/common/http.py", line 268, in json_request
    resp = self._http_request(url, method, **kwargs)
  File "/usr/lib/python2.7/site-packages/heatclient/common/http.py", line 231, in _http_request
    raise exc.from_response(resp)
HTTPBadRequest: ERROR: The template is not a JSON object or YAML mapping.

It's very hard to understand from the errors what the source of the problem. It starts with the broken relative path in enable-tls.yaml and results in the GUI complaining about controller-role.yaml being not a JSON or YAML file (in fact it doesn't exist in this path).


Version-Release number of selected component (if applicable):
openstack-tripleo-common-7.6.1-0.20170926174320.el7ost.noarch
openstack-mistral-executor-5.1.1-0.20170926064249.943a0ad.el7ost.noarch
openstack-heat-engine-9.0.1-0.20170925083033.el7ost.noarch


How reproducible:
100%


Steps to Reproduce:
1. Break a relative path in one of the environment files that you're using in the deployment
2. Upload the file with the broken path to swift
3. Start a deployment


Actual results:
Mistral action fails. You get no clear error why this happens.


Expected results:
A clear error message pointing immediately to the broken relative path.

Comment 3 Zane Bitter 2017-11-09 19:42:31 UTC
Is it possible that the action is passing None in place of the contents of the file that is not found, instead of raising an error at the point where it is not finding it?

Comment 4 Steven Hardy 2017-11-14 09:40:10 UTC
Ok I tried to reproduce this directly via mistral to enable easier debugging, here are the steps I took:

Working with an existing deployed overcloud, default name/plan "overcloud":

mkdir tmp2
cd tmp2
openstack container save overcloud
vim environments/ssl/enable-tls.yaml # modify path as in report above
openstack object create overcloud environments/ssl/enable-tls.yaml
vim plan-environment.yaml # Add environments/ssl/enable-tls.yaml to the environments list, if it's not already present
openstack object create overcloud plan-environment.yaml

At this point we should have a plan which replicates that described by Udi

Then we run the deploy action manually via mistralclient:

echo '{"timeout": "60"}' > input.json
openstack action execution run tripleo.deployment.deploy input.json

(undercloud) [stack@undercloud plan_tmp]$ openstack action execution run tripleo.deployment.deploy input.json 
{"result": "Failed to run action [action_ex_id=None, action_cls='<class 'mistral.actions.action_factory.DeployStackAction'>', attributes='{}', params='{u'timeout': u'60'}']\n ERROR: resources.Controller<nested_stack>.resources.0<http://192.168.24.1:8080/v1/AUTH_ef51214d730b4eaaa63d006cbf03145b/overcloud/puppet/controller-role.yaml>: : The template is not a JSON object or YAML mapping."}

So I think the reproduces the same issue reported?

Comment 5 Rabi Mishra 2017-12-14 15:46:13 UTC
bacport merged upstream, would be taken care of in rebase?

Comment 11 Thomas Hervé 2018-08-08 12:51:44 UTC
Verified thanks to Steven helpful process:

$ openstack action execution run tripleo.deployment.deploy input.json
{"result": "404 Client Error: Not Found for url: https://192.168.24.2:13808/v1/AUTH_cc07ed8e1e704c9c8670b644871dadf8/overcloud/environments/puppet/extraconfig/tls/tls-cert-inject.yaml"}

Comment 13 errata-xmlrpc 2018-08-20 12:58:30 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:2331


Note You need to log in before you can comment on or make changes to this bug.