removed getaddr from node clients, since it was not being used
This commit is contained in:
parent
e4bb315c14
commit
d3d70ecc54
5 changed files with 0 additions and 138 deletions
|
@ -95,40 +95,6 @@ class DockerClient(object):
|
|||
if status:
|
||||
raise CoreCommandError(status, args, output)
|
||||
|
||||
def getaddr(self, ifname, rescan=False):
|
||||
"""
|
||||
Get address for interface on node.
|
||||
|
||||
:param str ifname: interface name to get address for
|
||||
:param bool rescan: rescan flag
|
||||
:return: interface information
|
||||
:rtype: dict
|
||||
"""
|
||||
if ifname in self._addr and not rescan:
|
||||
return self._addr[ifname]
|
||||
|
||||
interface = {"ether": [], "inet": [], "inet6": [], "inet6link": []}
|
||||
args = ["ip", "addr", "show", "dev", ifname]
|
||||
status, output = self.ns_cmd(args)
|
||||
for line in output:
|
||||
line = line.strip().split()
|
||||
if line[0] == "link/ether":
|
||||
interface["ether"].append(line[1])
|
||||
elif line[0] == "inet":
|
||||
interface["inet"].append(line[1])
|
||||
elif line[0] == "inet6":
|
||||
if line[3] == "global":
|
||||
interface["inet6"].append(line[1])
|
||||
elif line[3] == "link":
|
||||
interface["inet6link"].append(line[1])
|
||||
else:
|
||||
logging.warning("unknown scope: %s" % line[3])
|
||||
|
||||
if status:
|
||||
logging.warning("nonzero exist status (%s) for cmd: %s", status, args)
|
||||
self._addr[ifname] = interface
|
||||
return interface
|
||||
|
||||
|
||||
class DockerNode(CoreNode):
|
||||
apitype = NodeTypes.DOCKER.value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue