[PATCH master] Remove unused functions (networking).

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

 



---
 pyanaconda/network.py                 |   38 -------------------------
 tests/pyanaconda_test/network_test.py |   50 ---------------------------------
 2 files changed, 0 insertions(+), 88 deletions(-)

diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index 83a299a..831af57 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -408,11 +408,6 @@ class Network:
                         self.ksdevice = dev
                         break
 
-
-
-    def getDevice(self, device):
-        return self.netdevices[device]
-
     def getKSDevice(self):
         if self.ksdevice is None:
             return None
@@ -470,29 +465,6 @@ class Network:
                 return dev.get('IPV6_DEFAULTGW')
         return ""
 
-    def lookupHostname(self):
-        # can't look things up if they don't exist!
-        if not self.hostname or self.hostname == "localhost.localdomain":
-            return None
-
-        if not hasActiveNetDev():
-            log.warning("no network devices were available to look up host name")
-            return None
-
-        try:
-            (family, socktype, proto, canonname, sockaddr) = \
-                socket.getaddrinfo(self.hostname, None, socket.AF_INET)[0]
-            (ip, port) = sockaddr
-        except:
-            try:
-                (family, socktype, proto, canonname, sockaddr) = \
-                    socket.getaddrinfo(self.hostname, None, socket.AF_INET6)[0]
-                (ip, port, flowinfo, scopeid) = sockaddr
-            except:
-                return None
-
-        return ip
-
     # Note that the file is written-out only if there is a value
     # that has changed.
     def writeIfcfgFiles(self):
@@ -629,16 +601,6 @@ class Network:
             line += "\n"
             f.write(line)
 
-    def hasNameServers(self, hash):
-        if hash.keys() == []:
-            return False
-
-        for key in hash.keys():
-            if key.upper().startswith('DNS'):
-                return True
-
-        return False
-
     def hasWirelessDev(self):
         for dev in self.netdevices:
             if isys.isWirelessDevice(dev):
diff --git a/tests/pyanaconda_test/network_test.py b/tests/pyanaconda_test/network_test.py
index e044d39..d188afa 100644
--- a/tests/pyanaconda_test/network_test.py
+++ b/tests/pyanaconda_test/network_test.py
@@ -316,14 +316,6 @@ class NetworkTest(mock.TestCase):
     #def network_update_test(self):
     #    pass
     
-    def network_get_device_test(self):
-        import pyanaconda.network       
-        
-        nw = pyanaconda.network.Network()
-        nw.netdevices['dev'] = 'device'
-        ret = nw.getDevice('dev')
-        self.assertEqual(ret, 'device')
-        
     def network_get_ks_device_1_test(self):
         import pyanaconda.network
         nw = pyanaconda.network.Network()
@@ -370,32 +362,6 @@ class NetworkTest(mock.TestCase):
         self.assertEqual(pyanaconda.network.Network.netdevices['eth0'].method_calls,
             [('set', (('GATEWAY', '10.0.0.1'),), {})])
     
-    def network_lookup_hostname_1_test(self):
-        import pyanaconda.network
-        nw = pyanaconda.network.Network()
-        nw.hostname = None
-        ret = nw.lookupHostname()
-        self.assertEqual(ret, None)
-    
-    def network_lookup_hostname_2_test(self):
-        import pyanaconda.network
-        nw = pyanaconda.network.Network()
-        nw.hostname = 'desktop'
-        pyanaconda.network.hasActiveNetDev = mock.Mock(return_value=False)
-        ret = nw.lookupHostname()
-        self.assertEqual(ret, None)
-    
-    def network_lookup_hostname_3_test(self):
-        import pyanaconda.network
-        pyanaconda.network.socket.getaddrinfo.return_value = \
-            [(0, 0, 0, 0, ('10.1.1.1', 0))]
-        
-        nw = pyanaconda.network.Network()
-        nw.hostname = 'desktop'
-        pyanaconda.network.hasActiveNetDev = mock.Mock(return_value=True)
-        ret = nw.lookupHostname()
-        self.assertEqual(ret, '10.1.1.1')
-    
     def network_write_ifcfg_files_test(self):
         import pyanaconda.network
         nw = pyanaconda.network.Network()
@@ -518,22 +484,6 @@ class NetworkTest(mock.TestCase):
         
         self.assertEqual(self.fs[TMPFILE], 
             'network --device eth0 --bootproto dhcp --noipv6\n')
-    
-    def network_has_name_server_1_test(self):
-        import pyanaconda.network
-        hash = {'foo':'', 'bar':''}
-        
-        nw = pyanaconda.network.Network()
-        ret = nw.hasNameServers(hash)
-        self.assertFalse(ret)
-    
-    def network_has_name_server_2_test(self):
-        import pyanaconda.network
-        hash = {'foo':'', 'bar':'', 'dnsserver':''}
-        
-        nw = pyanaconda.network.Network()
-        ret = nw.hasNameServers(hash)
-        self.assertTrue(ret)
         
     def network_has_wireless_dev_1_test(self):
         import pyanaconda.network
-- 
1.7.2

_______________________________________________
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