non-existent paths do not raise correct exception

Bug #1732335 reported by Rabi Mishra
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
High
Rabi Mishra

Bug Description

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).

It seems we ignore the http error code[1] in ProcessTemplateAction and just populate the content which would be some thing like
'<html><h1>Not Found</h1><p>The resource could not be found.</p></html>'

[1] https://github.com/openstack/tripleo-common/blob/master/tripleo_common/actions/templates.py#L393

Simpler way to reproduce (Thanks shardy):

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

mkdir tmp
cd tmp
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."}

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-common (master)

Fix proposed to branch: master
Review: https://review.openstack.org/519962

Changed in tripleo:
assignee: nobody → Rabi Mishra (rabi)
status: New → In Progress
Steven Hardy (shardy)
Changed in tripleo:
importance: Undecided → High
milestone: none → queens-2
tags: added: pike-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-common (master)

Reviewed: https://review.openstack.org/519962
Committed: https://git.openstack.org/cgit/openstack/tripleo-common/commit/?id=d8e8458f9eacbf1f4a0fc7d5801bb6229e10793a
Submitter: Zuul
Branch: master

commit d8e8458f9eacbf1f4a0fc7d5801bb6229e10793a
Author: rabi <email address hidden>
Date: Wed Nov 15 09:36:55 2017 +0530

    Raise stored HTTPError when fetching swift object

    We seem to ignore the HttpError and just use the content
    from the response.

    Change-Id: I762398c46c5a84002910a3d5f9be00783ed270c6
    Closes-Bug: #1732335

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-common (stable/pike)

Fix proposed to branch: stable/pike
Review: https://review.openstack.org/522558

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-common 8.2.0

This issue was fixed in the openstack/tripleo-common 8.2.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-common (stable/pike)

Reviewed: https://review.openstack.org/522558
Committed: https://git.openstack.org/cgit/openstack/tripleo-common/commit/?id=e5752db729756639706f5d7196095f92de32be00
Submitter: Zuul
Branch: stable/pike

commit e5752db729756639706f5d7196095f92de32be00
Author: rabi <email address hidden>
Date: Wed Nov 15 09:36:55 2017 +0530

    Raise stored HTTPError when fetching swift object

    We seem to ignore the HttpError and just use the content
    from the response.

    Change-Id: I762398c46c5a84002910a3d5f9be00783ed270c6
    Closes-Bug: #1732335
    (cherry picked from commit d8e8458f9eacbf1f4a0fc7d5801bb6229e10793a)

tags: added: in-stable-pike
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-common 7.6.7

This issue was fixed in the openstack/tripleo-common 7.6.7 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.