mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
facts: detect IP addresses on busybox properly (#51131)
* facts: detect IP addresses on busybox properly Fixes #50871 * Check rc before parsing data * Ooops
This commit is contained in:
parent
16511501b6
commit
11fb0a5d6a
2 changed files with 13 additions and 3 deletions
2
changelogs/fragments/50871-facts-ip-addr-busybox.yaml
Normal file
2
changelogs/fragments/50871-facts-ip-addr-busybox.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- Detect IP addresses on a system with busybox properly (https://github.com/ansible/ansible/issues/50871)
|
|
@ -256,12 +256,20 @@ class LinuxNetwork(Network):
|
|||
|
||||
args = [ip_path, 'addr', 'show', 'primary', device]
|
||||
rc, primary_data, stderr = self.module.run_command(args, errors='surrogate_then_replace')
|
||||
if rc == 0:
|
||||
parse_ip_output(primary_data)
|
||||
else:
|
||||
# possibly busybox, fallback to running without the "primary" arg
|
||||
# https://github.com/ansible/ansible/issues/50871
|
||||
args = [ip_path, 'addr', 'show', device]
|
||||
rc, data, stderr = self.module.run_command(args, errors='surrogate_then_replace')
|
||||
if rc == 0:
|
||||
parse_ip_output(data)
|
||||
|
||||
args = [ip_path, 'addr', 'show', 'secondary', device]
|
||||
rc, secondary_data, stderr = self.module.run_command(args, errors='surrogate_then_replace')
|
||||
|
||||
parse_ip_output(primary_data)
|
||||
parse_ip_output(secondary_data, secondary=True)
|
||||
if rc == 0:
|
||||
parse_ip_output(secondary_data, secondary=True)
|
||||
|
||||
interfaces[device].update(self.get_ethtool_data(device))
|
||||
|
||||
|
|
Loading…
Reference in a new issue