Only allow node to be activated if properties are set

Change-Id: Id049521e11ba67c20688dba5470d7e7085b9ed9f
This commit is contained in:
Tzu-Mainn Chen 2014-09-03 05:22:51 +02:00
parent f1338c1cf4
commit 7d16f7d30e

View File

@ -42,6 +42,10 @@ class ActivateNode(tables.BatchAction):
data_type_singular = _("Node")
data_type_plural = _("Nodes")
def allowed(self, request, obj=None):
return (obj.cpus and obj.memory_mb and
obj.local_gb and obj.cpu_arch)
def action(self, request, obj_id):
api.node.Node.set_maintenance(request, obj_id, False)