check actionplan state when deleting actionplan
If actionplan is 'ONGOING' or 'PENDING', don't delete it. Change-Id: I8bfa31a70bba0a7adb1bfd09fc22e6a66b9ebf3a Closes-Bug: #1738360
This commit is contained in:
@@ -460,6 +460,15 @@ class ActionPlansController(rest.RestController):
|
||||
policy.enforce(context, 'action_plan:delete', action_plan,
|
||||
action='action_plan:delete')
|
||||
|
||||
allowed_states = (ap_objects.State.SUCCEEDED,
|
||||
ap_objects.State.RECOMMENDED,
|
||||
ap_objects.State.FAILED,
|
||||
ap_objects.State.SUPERSEDED,
|
||||
ap_objects.State.CANCELLED)
|
||||
if action_plan.state not in allowed_states:
|
||||
raise exception.DeleteError(
|
||||
state=action_plan.state)
|
||||
|
||||
action_plan.soft_delete()
|
||||
|
||||
@wsme.validate(types.uuid, [ActionPlanPatchType])
|
||||
|
||||
Reference in New Issue
Block a user