Douglas Schilling Landgraf has uploaded a new change for review.

Change subject: engine_page: network is required to register tab
......................................................................

engine_page: network is required to register tab

oVirt Engine tab will only show the options for register
once the oVirt Node has the network setup.

Change-Id: Ic2563804673954234f3c29fed80ca54fe195d35a
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1064206
Signed-off-by: Douglas Schilling Landgraf <dougsl...@redhat.com>
---
M src/engine_page.py
1 file changed, 46 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node-plugin-vdsm 
refs/changes/28/26228/1

diff --git a/src/engine_page.py b/src/engine_page.py
index b59c166..21a8906 100644
--- a/src/engine_page.py
+++ b/src/engine_page.py
@@ -56,7 +56,6 @@
             else:
                 mgmtIface = [networks[net]['iface']]
 
-
     if cfg["server"] is not None:
         server_url = [unicode(info) for info in [cfg["server"], cfg["port"]] 
if info]
         engine_data = "oVirt Engine http://%s"; % ":".join(server_url)
@@ -102,25 +101,54 @@
 
     def ui_content(self):
         sync_mgmt()
-        ws = [ui.Header("header[0]",
-              "{engine_name} Configuration".format(
-                  engine_name=config.engine_name)),
-              ui.Entry("vdsm_cfg.address", "Management Server:"),
-              ui.Entry("vdsm_cfg.port", "Management Server Port:"),
-              ui.Divider("divider[0]"),
-              ui.SaveButton("action.fetch_cert", "Retrieve Certificate"),
-              ui.KeywordLabel("vdsm_cfg.cert", "Certificate Status: "),
-              ui.Divider("divider[1]"),
-              ui.Label("vdsm_cfg.password._label",
-                       "Optional password for adding Node through oVirt " +
-                       "Engine UI"),
-              ui.Label("vdsm_cfg.password._label2",
-                       "Note: Setting password will enable SSH daemon"),
-              ui.ConfirmedEntry("vdsm_cfg.password", "Password:", True),
-              ]
+
+        net_is_configured = utils.network.NodeNetwork().is_configured()
+        header_menu = "{engine_name} Configuration".format(
+            engine_name=config.engine_name
+        )
+
+        if not net_is_configured:
+            ws = [
+                ui.Header(
+                    "header[0]",
+                    header_menu
+                ),
+                ui.Notice("network.notice",
+                          "Networking is not configured, " +
+                          "please configure it before " +
+                          "registering"),
+                ui.Divider("divider[0]")
+            ]
+        else:
+            ws = [
+                ui.Header(
+                    "header[0]",
+                    header_menu
+                ),
+                ui.Entry("vdsm_cfg.address", "Management Server:"),
+                ui.Entry("vdsm_cfg.port", "Management Server Port:"),
+                ui.Divider("divider[0]"),
+                ui.SaveButton("action.fetch_cert", "Retrieve Certificate"),
+                ui.KeywordLabel("vdsm_cfg.cert", "Certificate Status: "),
+                ui.Divider("divider[1]"),
+                ui.Label("vdsm_cfg.password._label",
+                         "Optional password for adding Node through oVirt " +
+                         "Engine UI"),
+                ui.Label("vdsm_cfg.password._label2",
+                         "Note: Setting password will enable SSH daemon"),
+                ui.ConfirmedEntry("vdsm_cfg.password", "Password:", True),
+            ]
 
         page = ui.Page("page", ws)
-        page.buttons = [ui.SaveButton("action.register", "Save & Register")]
+        page.buttons = []
+
+        if net_is_configured:
+            page.buttons = [
+                ui.SaveButton(
+                    "action.register",
+                    "Save & Register"
+                )
+            ]
 
         self.widgets.add(page)
         return page


-- 
To view, visit http://gerrit.ovirt.org/26228
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic2563804673954234f3c29fed80ca54fe195d35a
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node-plugin-vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsl...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to