OSC plugin: Missing template gives unhelpful error

Bug #1570229 reported by Steven Hardy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-heatclient
Fix Committed
Medium
Paul Breaux

Bug Description

$ openstack stack create patch_test_20363 -t patch_20363.yaml
ERROR: None
-bash-4.3$ cat patch_20363.yaml
cat: patch_20363.yaml: No such file or directory

Oops - I used the wrong template name, but it doesn't give a good error - it should work like the old client did and tell me what is wrong:

heat stack-create patch_test_20363 -f patch_20363.yaml
<urlopen error [Errno 2] No such file or directory: '/opt/stack/heat-templates/stress/patch_20363.yaml'>

Paul Breaux (p-breaux)
Changed in python-heatclient:
assignee: nobody → Paul Breaux (p-breaux)
Revision history for this message
Paul Breaux (p-breaux) wrote :

Appears as though the culprit is here:

https://github.com/openstack/python-heatclient/blob/master/heatclient/common/template_utils.py#L39

The initial call to 'get_template_contents' raises this error if the file is not found, yet the exception is caught and the function is run again (expecting a template object this time), and a different exception is raised because a different path is taken. I'll implement a fix and submit it for review.

Paul Breaux (p-breaux)
Changed in python-heatclient:
status: New → Confirmed
description: updated
Changed in python-heatclient:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-heatclient (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-heatclient (master)

Reviewed: https://review.openstack.org/311662
Committed: https://git.openstack.org/cgit/openstack/python-heatclient/commit/?id=f5d4721e5ff9ef1ff1bffec79ea8e024275d6798
Submitter: Jenkins
Branch: master

commit f5d4721e5ff9ef1ff1bffec79ea8e024275d6798
Author: Paul Breaux <email address hidden>
Date: Sun May 1 21:46:27 2016 -0600

    Fix obscure error message when no template given to OSC

    This is an internal-only fix, as it does not change any external APIs. A
    bit of obfuscation was occurring in the
    'template_utils.process_template_path' function call. First we try to
    retrieve the template from a urllib call. If that fails, then we try to
    make a request with the custom request_object function. If the
    request_object function failed to retrieve the template as well, it
    would report back 'ERROR: None'. I left both of the calls in this
    function, but I made the first exception bubble up back to the caller,
    since it is more helpful to the user.

    The new error message should report back the following when a template
    cannot be found:

    <urlopen error [Errno 2] No such file or directory:
    '/root/python-heatclient/test.yaml'>

    Closed Bug: #1570229

    Change-Id: I29e19172322c18559aa476744f7ff3530e689bd0

Paul Breaux (p-breaux)
Changed in python-heatclient:
status: In Progress → Fix Committed
Changed in python-heatclient:
importance: Undecided → Medium
milestone: none → 1.3.0
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.