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

[PATCH] Pychecker: network.py - missing anaconda



Hi,

patch which hopefuly solves the issue found by pychecker.

-- 
Martin Sivak
msivak redhat com

Red Hat Czech s.r.o.
http://cz.redhat.com
Purkynova 99/71, 612 45 Brno, Czech Republic
Registered in Brno under #CZ27690016

diff --git a/anaconda b/anaconda
index 67781f5..c89fb49 100755
--- a/anaconda
+++ b/anaconda
@@ -381,7 +381,7 @@ def expandFTPMethod(opts):
     opts.method = opts.method[:len(opts.method) - 1]
     os.unlink(filename)
 
-def runVNC(vncpassword, vncconnecthost, vncconnectport, vncStartedCB=None):
+def runVNC(vncpassword, vncconnecthost, vncconnectport, vncStartedCB=None, id = None):
     # dont run vncpassword if in test mode
     if flags.test:
 	vncpassword = ""
@@ -389,7 +389,7 @@ def runVNC(vncpassword, vncconnecthost, vncconnectport, vncStartedCB=None):
     vnc.startVNCServer(vncpassword=vncpassword,
 		       vncconnecthost=vncconnecthost,
 		       vncconnectport=vncconnectport,
-                       vncStartedCB=vncStartedCB)
+                       vncStartedCB=vncStartedCB, id = id)
 
     child = os.fork()
     if child == 0:
@@ -890,7 +890,7 @@ if __name__ == "__main__":
 
     # if they want us to use VNC do that now
     if opts.display_mode == 'g' and flags.usevnc:
-        runVNC(vncpassword, vncconnecthost, vncconnectport, doStartupX11Actions)
+        runVNC(vncpassword, vncconnecthost, vncconnectport, doStartupX11Actions, id = anaconda.id)
 
     anaconda.setInstallInterface(opts.display_mode)
 
diff --git a/instdata.py b/instdata.py
index f6903f3..cc6cb89 100644
--- a/instdata.py
+++ b/instdata.py
@@ -52,8 +52,8 @@ class InstallData:
 	#	- The keyboard
 
 	self.instClass = None
-	self.network = network.Network()
 	self.iscsi = iscsi.iscsi()
+	self.network = network.Network(id = self)
 	self.zfcp = zfcp.ZFCP()
 	self.firewall = firewall.Firewall()
         self.security = security.Security()
diff --git a/network.py b/network.py
index a5bae0d..a25bfc8 100644
--- a/network.py
+++ b/network.py
@@ -107,7 +107,7 @@ def sanityCheckIPString(ip_string):
 
 def hasActiveNetDev():
     # try to load /tmp/netinfo and see if we can sniff out network info
-    netinfo = Network()
+    netinfo = Network(id = None) #we do not need id now, no ibft work is done here
     for dev in netinfo.netdevices.keys():
         try:
             ip = isys.getIPAddress(dev)
@@ -169,7 +169,7 @@ class NetworkDevice(SimpleConfigFile):
 	    self.info["TYPE"] = "IUCV"
 
 class Network:
-    def __init__(self):
+    def __init__(self, id = None):
 	self.firstnetdevice = None
         self.netdevices = {}
         self.gateway = ""
@@ -179,6 +179,7 @@ class Network:
 	self.isConfigured = 0
         self.hostname = "localhost.localdomain"
         self.query = False
+        self.id = id #install data
 
         # if we specify a hostname and are using dhcp, do an override
         # originally used by the gui but overloaded now
@@ -343,21 +344,21 @@ class Network:
                 while True:
                     if (usemethod == "ibft" and dev.get('onboot') == "yes"):
                         try:
-                            if anaconda.id.iscsi.fwinfo["iface.bootproto"].lower() == "dhcp":
+                            if self.id.iscsi.fwinfo["iface.bootproto"].lower() == "dhcp":
                                 usemethod = "dhcp"
                                 continue
                             else:
                                 hwaddr = isys.getMacAddress(dev)
-                                if hwaddr != anaconda.id.iscsi.fwinfo["iface.hwaddress"]:
+                                if hwaddr != self.id.iscsi.fwinfo["iface.hwaddress"]:
                                     log.error("The iBFT configuration does not belong to device %s,"
                                               "falling back to dhcp", dev.get('device'))
                                     usemethod = "dhcp"
                                     continue
 
                                 isys.configNetDevice(dev.get('device'),
-                                                     anaconda.id.iscsi.fwinfo["iface.ipaddress"],
-                                                     anaconda.id.iscsi.fwinfo["iface.subnet_mask"],
-                                                     anaconda.id.iscsi.fwinfo["iface.gateway"])
+                                                     self.id.iscsi.fwinfo["iface.ipaddress"],
+                                                     self.id.iscsi.fwinfo["iface.subnet_mask"],
+                                                     self.id.iscsi.fwinfo["iface.gateway"])
                                 self.isConfigured = 1
                         except:
                             log.error("failed to configure network device %s using "
diff --git a/vnc.py b/vnc.py
index 81882ba..531fde7 100644
--- a/vnc.py
+++ b/vnc.py
@@ -153,7 +153,7 @@ def getVNCPassword():
 
 # startup vnc X server
 def startVNCServer(vncpassword="", root='/', vncconnecthost="",
-		   vncconnectport="", vncStartedCB=None):
+		   vncconnectport="", vncStartedCB=None, id = None):
 
     stdoutLog = logging.getLogger("anaconda.stdout")
     
@@ -197,7 +197,7 @@ def startVNCServer(vncpassword="", root='/', vncconnecthost="",
 	import network
 
 	# try to load /tmp/netinfo and see if we can sniff out network info
-	netinfo = network.Network()
+	netinfo = network.Network(id = id)
 	srvname = None
 
         # If we have a real hostname that resolves against configured DNS

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