Fixes instance double delete via row_action

Currently when an instance is terminated, via the project/instances view,
a "Terminate Instnace" button appears in the row_action column.

This is due to a the TerminateInstance class's allowed() method always
returning true.

By putting logic in this method to only allow the terminate row_action
when an instance is *not* being deleted, we prevent the double delete from
occurring via row_action.

Change-Id: I23e759036c8f6c35331243717853c8a5e269fa75
Closes-Bug: 1278487
This commit is contained in:
David Lapsley 2014-02-10 12:01:17 -08:00
parent 0c4cf9aacf
commit ccc71b2090
1 changed files with 2 additions and 1 deletions

View File

@ -87,7 +87,8 @@ class TerminateInstance(tables.BatchAction):
return {"project_id": project_id}
def allowed(self, request, instance=None):
return True
"""Allow terminate action if instance not currently being deleted."""
return not is_deleting(instance)
def action(self, request, obj_id):
api.nova.server_delete(request, obj_id)