Plan creation doesn't stop when an action fails

Bug #1621493 reported by Julie Pichon on 2016-09-08
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Medium
Julie Pichon

Bug Description

Steps to reproduce:

1. Have a container created in Swift

$ swift list
custom-plan

2. Try to create a plan with templates and the same name

$ openstack overcloud plan create --templates /usr/share/openstack-tripleo-heat-templates/ custom-plan
Creating Swift container to store the plan
Creating plan from template files in: /usr/share/openstack-tripleo-heat-templates/
Exception creating plan: Error occurred creating plan: Duplicate entry for Environment: ['name']

Expected results: The plan creation stops right at "Creating Swift container to store the plan" with an error message about a container already existing with that name.

Additional info:

This works fine when create the default plan, because all the steps are in a workflow and the container check is done at the workflow level ( https://github.com/openstack/tripleo-common/blob/dba588/workbooks/plan_management.yaml#L84 ).

$ openstack overcloud plan create custom-plan
Exception creating plan: Unable to create plan. The Swift container already exists

This may be due because we're not returning an exception at https://github.com/openstack/tripleo-common/blob/dba588/tripleo_common/actions/plan.py#L52 so the client code at https://github.com/openstack/python-tripleoclient/blob/943f55/tripleoclient/workflows/plan_management.py#L103 goes ahead without checking the result for errors.

Julie Pichon (jpichon) wrote :

If the container was already a plan, the command fails because of the mistral environment so there shouldn't be problems with accidentally overwritten templates/plan. However if it wasn't, it looks like the command will fail silently:

$ swift list
custom-plan
test

$ openstack overcloud plan list
+-----------------------------+
| Plan Name |
+-----------------------------+
| custom-plan |
+-----------------------------+

$ openstack overcloud plan create --templates /usr/share/openstack-tripleo-heat-templates/ test
Creating Swift container to store the plan
Creating plan from template files in: /usr/share/openstack-tripleo-heat-templates/
Plan created

$ openstack overcloud plan list
+-----------------------------+
| Plan Name |
+-----------------------------+
| custom-plan |
+-----------------------------+

I'll update the bug title.

summary: - Plan creation doesn't stop when the container already exists
+ Plan creation doesn't stop when an action fails
Julie Pichon (jpichon) wrote :

Chatting with d0ugal on #tripleo, returning a Mistral Result with the 'error' attribute set is the expected pattern, as Mistral will mark a Task as failed whenever this attribute is set. The issue comes from the client side: in the future we probably want to move these methods to be entirely done via workflows (e.g. using following the JSON approach at https://review.openstack.org/#/c/347830/ though that'll likely needs to be done in other places too). In the meantime we need to check each call's result.

description: updated
Changed in tripleo:
milestone: none → newton-rc1
Julie Pichon (jpichon) on 2016-09-13
Changed in tripleo:
assignee: nobody → Julie Pichon (jpichon)

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

Changed in tripleo:
status: Triaged → In Progress
Changed in tripleo:
milestone: newton-rc1 → newton-rc2
tags: added: newton-backport-potential

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

commit fe28e43c3e4adbd4923176efa94f60fbc6583648
Author: Julie Pichon <email address hidden>
Date: Tue Sep 13 19:09:30 2016 +0100

    Stop plan creation when container exists

    The action result was not properly checked, leading to errors being
    missed and the plan creation failing, sometimes silently.

    Change-Id: I8c5391be5ff7bc4c7227ebbe4f8200eda6f8de09
    Closes-Bug: #1621493

Changed in tripleo:
status: In Progress → Fix Released

Reviewed: https://review.openstack.org/376264
Committed: https://git.openstack.org/cgit/openstack/python-tripleoclient/commit/?id=6365c76c27bd95693db9c3626b080e65d003805d
Submitter: Jenkins
Branch: stable/newton

commit 6365c76c27bd95693db9c3626b080e65d003805d
Author: Julie Pichon <email address hidden>
Date: Tue Sep 13 19:09:30 2016 +0100

    Stop plan creation when container exists

    The action result was not properly checked, leading to errors being
    missed and the plan creation failing, sometimes silently.

    Change-Id: I8c5391be5ff7bc4c7227ebbe4f8200eda6f8de09
    Closes-Bug: #1621493
    (cherry picked from commit fe28e43c3e4adbd4923176efa94f60fbc6583648)

tags: added: in-stable-newton

This issue was fixed in the openstack/python-tripleoclient 5.2.0 release.

This issue was fixed in the openstack/python-tripleoclient 5.5.0 release.

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

Other bug subscribers