summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Brady <rbrady@redhat.com>2015-08-11 11:23:03 -0400
committerRyan Brady <rbrady@redhat.com>2015-08-14 10:20:48 -0400
commit64eeb59c725efbfd4d20c078c5aaea2963ddde6c (patch)
treee48ab7b78f5600ac6c62db2a9a6b1a4aa8c20141
parent6bec389675d7717e9507dd9bf74a0f881c0b5675 (diff)
downloadtuskar-ui-64eeb59c725efbfd4d20c078c5aaea2963ddde6c.tar.gz
Add discovery on demand
If node introspection fails, there is no way to re-run the process within the UI. This patch adds a button to the maintenance tab to allow a user to re-run the process. Change-Id: I16645643de83f212e89f858a85589d425474c5cd
-rw-r--r--tuskar_ui/infrastructure/nodes/tables.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/tuskar_ui/infrastructure/nodes/tables.py b/tuskar_ui/infrastructure/nodes/tables.py
index 65a5cf56..898bd76e 100644
--- a/tuskar_ui/infrastructure/nodes/tables.py
+++ b/tuskar_ui/infrastructure/nodes/tables.py
@@ -128,6 +128,27 @@ class NodeFilterAction(tables.FilterAction):
return filter(comp, nodes)
+class DiscoverNode(tables.BatchAction):
+ name = "discover_nodes"
+ action_present = _("Discover")
+ action_past = _("Discovered")
+ data_type_singular = _("Node")
+ data_type_plural = _("Nodes")
+
+ def allowed(self, request, obj=None):
+ if not obj:
+ # this is necessary because table actions use this function
+ # with obj=None
+ return True
+ return obj.state == api.node.MAINTENANCE_STATE
+
+ def action(self, request, obj_id):
+ if obj_id is None:
+ messages.error(request, _("Select some nodes to discover."))
+ return
+ api.node.Node.discover(request, [obj_id])
+
+
@memoized.memoized
def _get_role_link(role_id):
if role_id:
@@ -242,7 +263,7 @@ class MaintenanceNodesTable(BaseNodesTable):
columns = ('node', 'cpus', 'memory_mb', 'local_gb', 'power_status',
'state')
table_actions = (NodeFilterAction, ActivateNode, SetPowerStateOn,
- SetPowerStateOff, DeleteNode)
+ SetPowerStateOff, DiscoverNode, DeleteNode)
row_actions = (ActivateNode, SetPowerStateOn, SetPowerStateOff,
DeleteNode)
template = "horizon/common/_enhanced_data_table.html"