Skip to content

Commit

Permalink
Merge pull request #537 from scaarup/master
Browse files Browse the repository at this point in the history
Now returns a list of ipv4 addresses #3
  • Loading branch information
pgbidkar committed Jan 4, 2019
2 parents 4b5910c + 024942f commit b88c941
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion samples/getvmsbycluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,14 @@ def getNICs(summary, guest):
nics[nic.macAddress] = {} # Use mac as uniq ID for nic
nics[nic.macAddress]['netlabel'] = nic.network
ipconf = nic.ipConfig.ipAddress
i = 0
nics[nic.macAddress]['ipv4'] = {}
for ip in ipconf:
if ":" not in ip.ipAddress: # Only grab ipv4 addresses
nics[nic.macAddress]['ip'] = ip.ipAddress
nics[nic.macAddress]['ipv4'][i] = ip.ipAddress
nics[nic.macAddress]['prefix'] = ip.prefixLength
nics[nic.macAddress]['connected'] = nic.connected
i = i+1
return nics


Expand Down

0 comments on commit b88c941

Please sign in to comment.