1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix linux 'ip' stdout parsing. (#16170)

With network-manager in debian (stretch) and openvpn connection enabled
the output for ipv6 is different and include a 'peer' keyword.

Fixes #15448
This commit is contained in:
Zempashi 2016-06-17 23:10:45 +02:00 committed by Adrian Likins
parent 2275a08b9a
commit af150ea43a

View file

@ -2229,8 +2229,13 @@ class LinuxNetwork(Network):
if not address.startswith('127.'):
ips['all_ipv4_addresses'].append(address)
elif words[0] == 'inet6':
address, prefix = words[1].split('/')
scope = words[3]
if 'peer' == words[2]:
address = words[1]
_, prefix = words[3].split('/')
scope = words[5]
else:
address, prefix = words[1].split('/')
scope = words[3]
if 'ipv6' not in interfaces[device]:
interfaces[device]['ipv6'] = []
interfaces[device]['ipv6'].append({