action-update API on non existing action - creates action instead of returning 404

Bug #1568541 reported by Moshe Elisha
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
Medium
Dougal Matthews

Bug Description

"action-update" API (i.e., HTTP PUT "/actions") does "action-create" logic in case an action by that name does not exist.

I would expect a 404 Not Found.
"workflow-update" behaves as expected.

Changed in mistral:
assignee: nobody → Renat Akhmerov (rakhmerov)
milestone: none → newton-1
importance: Undecided → Medium
Changed in mistral:
milestone: newton-1 → newton-2
Changed in mistral:
assignee: Renat Akhmerov (rakhmerov) → Dougal Matthews (d0ugal)
Revision history for this message
Dougal Matthews (d0ugal) wrote :

From what I understand, this happens because of the logic in mistral/services/actions.py

update_action calls _append_all_actions which calls create_or_update_action. This logic needs to be split up so that update wont ever create.

Revision history for this message
Dougal Matthews (d0ugal) wrote :

Oh, I think I may have spotted an easy fix. WIP patch incoming for discussion.

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

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

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

Reviewed: https://review.openstack.org/331554
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=7b773bba05b2c9bd21141bede87c447ec867b064
Submitter: Jenkins
Branch: master

commit 7b773bba05b2c9bd21141bede87c447ec867b064
Author: Dougal Matthews <email address hidden>
Date: Mon Jun 20 09:27:35 2016 +0100

    Don't create actions when attempting to update one that doesn't exist

    The API called create_or_update_action_definition when doing a PUT
    request. This was incorrect, as updating an action that doesn't
    exist shouldn't create a new action - rather a 404 is expected.

    This change adds a new create_or_update_actions method that has
    has the previous behaviour and updates the action_manager.py to
    use this as it required the old behaviour. The update_actions
    method is then updated to use the DB API call that will error if
    the action doesn't exist.

    Change-Id: Iea9ce71078058224172d31e20d84746052a28b2f
    Closes-Bug: 1568541

Changed in mistral:
status: In Progress → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/mistral 3.0.0.0b2

This issue was fixed in the openstack/mistral 3.0.0.0b2 development milestone.

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.