From f9533d811ad51ca8077681e1873b31ba74015bcd Mon Sep 17 00:00:00 2001 From: Anders Blomdell <anders.blomdell@control.lth.se> Date: Wed, 21 Feb 2018 17:27:58 +0100 Subject: [PATCH] Add FQN for ipv6 domains --- src/hostinfo/yp.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/hostinfo/yp.py b/src/hostinfo/yp.py index df0a21b..08fa695 100755 --- a/src/hostinfo/yp.py +++ b/src/hostinfo/yp.py @@ -32,16 +32,22 @@ def ethers(tree): result = "" host = {} for i in filter(lambda i: i.ethernet[0], tree._host_._interface_): - host[i.ethernet[0]] = [ i.name[0:] ] + host[i.ethernet[0]] = set([ i.name[0:] ]) for ip in filter(util.address, i._ip_): fqn = util.fqn(tree, ip) if fqn: - host[i.ethernet[0]].append(fqn[0:-1]) + host[i.ethernet[0]].add(fqn[0:-1]) + pass + pass + for ipv6 in filter(util.address, i._ipv6_): + fqn = util.fqn(tree, ipv6) + if fqn: + host[i.ethernet[0]].add(fqn[0:-1]) pass pass pass for k in sorted(host, cmp=util.by_mac): - for h in host[k]: + for h in sorted(host[k]): result += "%-15s %s\n" % (k, h) return result -- GitLab