Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Restored get_ip behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Morgan Aubert committed Jun 1, 2017
1 parent 8768277 commit cd49216
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lxdock/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ def get_ip(container):
if state.network is None: # container is not running
return ''
eth0 = state.network['eth0']
ipv4, ipv6 = '', ''
# TODO: we only use IPv4 addresses for now. This should be updated in order to better support
# IPv6 addresses and LXD bridges configured for IPv6.
for addr in eth0['addresses']:
if addr['family'] == 'inet':
ipv4 = addr['address']
elif addr['family'] == 'inet6' and 'global' in addr['scope']:
ipv6 = addr['address']
return ipv4 or ipv6
return addr['address']
return ''


RE_ETCHOST_LINE = re.compile(r'^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+([\w\-_.]+)$')
Expand Down

0 comments on commit cd49216

Please sign in to comment.