]> git.uio.no Git - python-TSD.git/commitdiff
ip2host: added more flexibility
authorMartin S. Benonisen <m.s.benonisen@usit.uio.no>
Mon, 9 Nov 2015 11:52:16 +0000 (12:52 +0100)
committerMartin S. Benonisen <m.s.benonisen@usit.uio.no>
Mon, 9 Nov 2015 11:52:16 +0000 (12:52 +0100)
lib/TSD/common.py

index 309869048ca9b1ac00fc8947258457dd9dda8337..8276cde0de72800421292ea7f0bf889e2b065011 100644 (file)
@@ -146,14 +146,11 @@ Find network information about a host
                             ['networkAddress'])
     for hostdn, hostaddr in hostres:
         if 'networkAddress' in hostaddr:
-            if len(hostaddr['networkAddress']) == 2:
-                ipv4, ipv6 = hostaddr['networkAddress']
-            else:
-                for i in hostaddr['networkAddress']:
-                    if ":" in i:
-                        ipv6 = i
-                    elif "." in i:
-                        ipv4 = i
+            for i in hostaddr['networkAddress']:
+                if ":" in i:
+                    ipv6 = i
+                elif "." in i:
+                    ipv4 = i
             if "/" in ipv4:
                 vlan4, network4, prefix4 = ipv4.split("/")
                 network['vlan'] = vlan4