[node-patches] Change in ovirt-node[master]: setup.network: Fix static IP

fabiand at fedoraproject.org fabiand at fedoraproject.org
Tue Dec 11 20:09:44 UTC 2012


Fabian Deutsch has uploaded a new change for review.

Change subject: setup.network: Fix static IP
......................................................................

setup.network: Fix static IP

Change-Id: Ib65c2cf4b112faaff75eab8123b1ded7805af588
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/tui/src/ovirt/node/setup/network_page.py
M scripts/tui/src/ovirt/node/ui/__init__.py
2 files changed, 10 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/80/9980/1

diff --git a/scripts/tui/src/ovirt/node/setup/network_page.py b/scripts/tui/src/ovirt/node/setup/network_page.py
index 5f502e2..240ccdf 100644
--- a/scripts/tui/src/ovirt/node/setup/network_page.py
+++ b/scripts/tui/src/ovirt/node/setup/network_page.py
@@ -140,10 +140,9 @@
         self._widgets[path] = ui.Dialog(txt, widgets)
         return self._widgets[path]
 
-    def _build_nic_details_dialog(self):
-        self.logger.debug("Building NIC details dialog")
+    def _build_nic_details_dialog(self, iface):
         # Populate model with nic specific informations
-        iface = self._model["nics"]
+        self.logger.debug("Building NIC details dialog for %s" % iface)
 
         self.logger.debug("Getting informations for NIC details page")
         live = ovirt.node.utils.network.node_nics()[iface]
@@ -151,6 +150,10 @@
 
         self.logger.debug("live: %s" % live)
         self.logger.debug("cfg: %s" % cfg)
+
+        if cfg["iface"] != iface:
+            # create empty config if we are not editing the bootif
+            cfg = {k: "" for k in cfg.keys()}
 
         ipaddr, netmask, gateway, vlanid = (cfg["ipaddr"], cfg["netmask"],
                                             cfg["gateway"], cfg["vlanid"])
@@ -262,7 +265,7 @@
         if "nics" in changes and len(changes) == 1:
             iface = changes["nics"]
             self.logger.debug("Opening NIC Details dialog for '%s'" % iface)
-            self._nic_dialog = self._build_nic_details_dialog()
+            self._nic_dialog = self._build_nic_details_dialog(iface)
             return self._nic_dialog
 
         if "dialog.nic.close" in changes:
@@ -326,7 +329,7 @@
             model.update(iface, "dhcp", None, None, None, vlanid)
         elif bootproto == "static":
             self.logger.debug("Configuring static ip")
-            model.update(iface, "none", ipaddr, netmask, gateway, vlanid)
+            model.update(iface, "static", ipaddr, netmask, gateway, vlanid)
         else:
             self.logger.debug("No interface configuration found")
         # Return the resulting transaction
diff --git a/scripts/tui/src/ovirt/node/ui/__init__.py b/scripts/tui/src/ovirt/node/ui/__init__.py
index 359b059..edc40e7 100644
--- a/scripts/tui/src/ovirt/node/ui/__init__.py
+++ b/scripts/tui/src/ovirt/node/ui/__init__.py
@@ -386,7 +386,6 @@
         except Exception as e:
             self.add_update("\nAn error occurred when applying the changes:")
             self.add_update(e.message)
-            self.logger.warning("Exception '%s' on transaction " +
-                                "'%s': %s - %s" % (self.transaction, type(e),
-                                                      e, e.message))
+            self.logger.warning("'%s' on transaction '%s': %s - %s" %
+                                (type(e), self.transaction, e, e.message))
         self._close_button.enabled(True)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib65c2cf4b112faaff75eab8123b1ded7805af588
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>



More information about the node-patches mailing list