mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
(Re #882) Handle errors in get_interfaces
If there is an error in how interfaces are configured (or only one set, like IPv6), the setup command should not error out.
This commit is contained in:
parent
ffabded2e6
commit
3aff9396e8
1 changed files with 4 additions and 0 deletions
|
@ -467,6 +467,10 @@ class LinuxNetwork(Network):
|
|||
interface = dict(v4 = {}, v6 = {})
|
||||
for v in 'v4', 'v6':
|
||||
output = subprocess.Popen(command[v], stdout=subprocess.PIPE).communicate()[0]
|
||||
if not output:
|
||||
# v6 routing may result in
|
||||
# RTNETLINK answers: Invalid argument
|
||||
continue
|
||||
words = output.split('\n')[0].split()
|
||||
# A valid output starts with the queried address on the first line
|
||||
if words[0] == command[v][-1]:
|
||||
|
|
Loading…
Reference in a new issue