[PATCH] Avoid tracebacks when filling in static network config fields (#474275)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the user changes to static network configuration, we may or may not
have values already that we can populate the fields with.  If we do,
take them.  Otherwise, leave the field blank and keep going.
---
 iw/netconfig_dialog.py |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/iw/netconfig_dialog.py b/iw/netconfig_dialog.py
index 6a8bdc7..4818171 100644
--- a/iw/netconfig_dialog.py
+++ b/iw/netconfig_dialog.py
@@ -74,10 +74,29 @@ class NetworkConfigurator:
             self.xml.get_widget("dhcpCheckbutton").set_active(False)
 
             # FIXME: need to set ipv6 here too once we have that
-            if netdev.get('IPADDR'): self.xml.get_widget("ipv4Address").set_text(netdev.get('IPADDR'))
-            if netdev.get('NETMASK'): self.xml.get_widget("ipv4Netmask").set_text(netdev.get('NETMASK'))
-            if self.network.gateway: self.xml.get_widget("gatewayEntry").set_text(self.network.gateway)
-            if self.network.primaryNS: self.xml.get_widget("nameserverEntry").set_text(self.network.primaryNS)
+            try:
+                if netdev.get('IPADDR'):
+                    self.xml.get_widget("ipv4Address").set_text(netdev.get('IPADDR'))
+            except:
+                pass
+
+            try:
+                if netdev.get('NETMASK'):
+                    self.xml.get_widget("ipv4Netmask").set_text(netdev.get('NETMASK'))
+            except:
+                pass
+
+            try:
+                if self.network.gateway:
+                    self.xml.get_widget("gatewayEntry").set_text(self.network.gateway)
+            except:
+                pass
+
+            try:
+                if self.network.primaryNS:
+                    self.xml.get_widget("nameserverEntry").set_text(self.network.primaryNS)
+            except:
+                pass
 
     def _ipv4Toggled(self, cb):
         if self.xml.get_widget("dhcpCheckbutton").get_active():
-- 
1.6.0.3

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux