MCPcopy Create free account
hub / github.com/apache/cloudstack / get_ip

Function get_ip

systemvm/debian/opt/cloud/bin/cs/CsHelper.py:158–165  ·  view source on GitHub ↗

Return first ip on an interface

(device)

Source from the content-addressed store, hash-verified

156
157
158def get_ip(device):
159 """ Return first ip on an interface """
160 cmd = "ip addr show dev %s" % device
161 for i in execute(cmd):
162 vals = i.lstrip().split()
163 if (vals[0] == 'inet'):
164 return vals[1]
165 return ""
166
167
168def definedinfile(filename, val):

Callers

nothing calls this directly

Calls 1

executeFunction · 0.70

Tested by

no test coverage detected