overcloud plan delete returns 0 even when it crashes with an exception

Bug #1649588 reported by Jiří Stránský
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
Medium
Julie Pichon

Bug Description

Plan deletion has a return code 0 even on failure. (In case this is a more general tripleo CLI problem, other actions could be affected too perhaps.)

[stack@undercloud ~]$ openstack overcloud plan delete testplan
Deleting plan testplan...
Error deleting plan
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/tripleoclient/v1/overcloud_plan.py", line 74, in take_action
    input=workflow_input)
  File "/usr/lib/python2.7/site-packages/tripleoclient/workflows/plan_management.py", line 103, in delete_deployment_plan
    'Exception deleting plan: {}'.format(err))
WorkflowServiceError: Exception deleting plan: Invalid input [name=tripleo.plan.delete, class=NoneType, missing=['container'], unexpected=[u'input']]

[stack@undercloud ~]$ echo $?
0

Revision history for this message
Alex Schultz (alex-schultz) wrote :

I think this might be an openstack client issue as the exception is raised and I believe it's being caught outside of the tripleoclient codebase.

Changed in tripleo:
milestone: ongoing → ocata-3
Revision history for this message
Julie Pichon (jpichon) wrote :

Actually we don't re-raise the exception in the command itself: https://github.com/openstack/python-tripleoclient/blob/7dd16b/tripleoclient/v1/overcloud_plan.py#L72-#L76

If I slip in a 'raise' after the self.log.exception $? switches to 1 after the plan deletion fails, as expected.

I'll have a quick look through some of the other commands and submit a patch fixing the ones I notice. I don't think we need the try/catch at all for that particular case either.

$ openstack overcloud plan delete my-plan
Deleting plan my-plan...
Exception deleting plan: Invalid input [name=tripleo.plan.delete, class=NoneType, missing=['container'], unexpected=[u'input']]

Changed in tripleo:
assignee: nobody → Julie Pichon (jpichon)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-tripleoclient (master)

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

Changed in tripleo:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-tripleoclient (master)

Reviewed: https://review.openstack.org/410697
Committed: https://git.openstack.org/cgit/openstack/python-tripleoclient/commit/?id=bc1ac191a6c37e730cc97a9df660ba1c7c15f101
Submitter: Jenkins
Branch: master

commit bc1ac191a6c37e730cc97a9df660ba1c7c15f101
Author: Julie Pichon <email address hidden>
Date: Wed Dec 14 09:58:45 2016 +0000

    Return proper exit code on plan deletion failure

    Exceptions were swallowed, leading to the exit code always being 0.

    Change-Id: I49ef76aca828ab9eab2c4d134edcb190a89bca69
    Closes-Bug: #1649588

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-tripleoclient 6.0.0

This issue was fixed in the openstack/python-tripleoclient 6.0.0 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.