From ad9981f565ea00a857e895fd6a111705da676a05 Mon Sep 17 00:00:00 2001 From: Vitaliy Okulov Date: Sun, 10 May 2015 14:37:46 +0000 Subject: [PATCH 1/3] Fix for ansible/ansible#10917 Add missing broadcast addr for network facts for Linux --- lib/ansible/module_utils/facts.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index b223c5f5f7d..c4ad5cab738 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -1836,6 +1836,7 @@ class LinuxNetwork(Network): if words[0] == 'inet': if '/' in words[1]: address, netmask_length = words[1].split('/') + broadcast = words[3] else: # pointopoint interfaces do not have a prefix address = words[1] @@ -1849,6 +1850,7 @@ class LinuxNetwork(Network): interfaces[iface] = {} if not secondary and "ipv4" not in interfaces[iface]: interfaces[iface]['ipv4'] = {'address': address, + 'broadcast': broadcast, 'netmask': netmask, 'network': network} else: @@ -1856,6 +1858,7 @@ class LinuxNetwork(Network): interfaces[iface]["ipv4_secondaries"] = [] interfaces[iface]["ipv4_secondaries"].append({ 'address': address, + 'broadcast': broadcast, 'netmask': netmask, 'network': network, }) @@ -1866,12 +1869,14 @@ class LinuxNetwork(Network): interfaces[device]["ipv4_secondaries"] = [] interfaces[device]["ipv4_secondaries"].append({ 'address': address, + 'broadcast': broadcast, 'netmask': netmask, 'network': network, }) # If this is the default address, update default_ipv4 if 'address' in default_ipv4 and default_ipv4['address'] == address: + default_ipv4['broadcast'] = broadcast default_ipv4['netmask'] = netmask default_ipv4['network'] = network default_ipv4['macaddress'] = macaddress From 31b0ffafa85094a300c0bb7ec0eb7badfd2fb3a8 Mon Sep 17 00:00:00 2001 From: Vitaliy Okulov Date: Sun, 10 May 2015 14:43:36 +0000 Subject: [PATCH 2/3] Align fix for ansible/ansible#10917 --- lib/ansible/module_utils/facts.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index c4ad5cab738..83aef5bf30b 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -1836,7 +1836,7 @@ class LinuxNetwork(Network): if words[0] == 'inet': if '/' in words[1]: address, netmask_length = words[1].split('/') - broadcast = words[3] + broadcast = words[3] else: # pointopoint interfaces do not have a prefix address = words[1] @@ -1850,7 +1850,7 @@ class LinuxNetwork(Network): interfaces[iface] = {} if not secondary and "ipv4" not in interfaces[iface]: interfaces[iface]['ipv4'] = {'address': address, - 'broadcast': broadcast, + 'broadcast': broadcast, 'netmask': netmask, 'network': network} else: @@ -1858,7 +1858,7 @@ class LinuxNetwork(Network): interfaces[iface]["ipv4_secondaries"] = [] interfaces[iface]["ipv4_secondaries"].append({ 'address': address, - 'broadcast': broadcast, + 'broadcast': broadcast, 'netmask': netmask, 'network': network, }) @@ -1869,7 +1869,7 @@ class LinuxNetwork(Network): interfaces[device]["ipv4_secondaries"] = [] interfaces[device]["ipv4_secondaries"].append({ 'address': address, - 'broadcast': broadcast, + 'broadcast': broadcast, 'netmask': netmask, 'network': network, }) From 0c305b72cd61058666091895095d87d1ee787a19 Mon Sep 17 00:00:00 2001 From: Vitaliy Okulov Date: Mon, 11 May 2015 14:33:50 +0000 Subject: [PATCH 3/3] Fix align again, strange vim error. ansible/ansible#10917 --- lib/ansible/module_utils/facts.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 83aef5bf30b..b025a80d956 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -1836,7 +1836,7 @@ class LinuxNetwork(Network): if words[0] == 'inet': if '/' in words[1]: address, netmask_length = words[1].split('/') - broadcast = words[3] + broadcast = words[3] else: # pointopoint interfaces do not have a prefix address = words[1] @@ -1850,7 +1850,7 @@ class LinuxNetwork(Network): interfaces[iface] = {} if not secondary and "ipv4" not in interfaces[iface]: interfaces[iface]['ipv4'] = {'address': address, - 'broadcast': broadcast, + 'broadcast': broadcast, 'netmask': netmask, 'network': network} else: @@ -1858,7 +1858,7 @@ class LinuxNetwork(Network): interfaces[iface]["ipv4_secondaries"] = [] interfaces[iface]["ipv4_secondaries"].append({ 'address': address, - 'broadcast': broadcast, + 'broadcast': broadcast, 'netmask': netmask, 'network': network, }) @@ -1869,7 +1869,7 @@ class LinuxNetwork(Network): interfaces[device]["ipv4_secondaries"] = [] interfaces[device]["ipv4_secondaries"].append({ 'address': address, - 'broadcast': broadcast, + 'broadcast': broadcast, 'netmask': netmask, 'network': network, })