Skip to content

Commit

Permalink
Fix for filter - _interface_check. It fails because certain linux fla…
Browse files Browse the repository at this point in the history
…vors

report ipaddress under a different key - ipv4_secondaries.
  • Loading branch information
Avadhani Jonnavithula committed May 2, 2018
1 parent 9e495cf commit 80eb1a1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion filter_plugins/filters.py
Expand Up @@ -66,10 +66,18 @@ def _interface_check(context, interface, interface_type=None):
# Static IPv4 address
if interface.get("bootproto") == "static" and interface.get("address"):
fact_address = fact.get("ipv4", {}).get("address")
secondaries = fact.get("ipv4_secondaries", None)
if interface["address"] != "0.0.0.0":
# IP address
if not fact_address:
return _fail("Interface %s has no IPv4 address" % device)
if not secondaries:
return _fail("Interface %s has no IPv4 address" % device)
else:
for address_dict in secondaries:
if interface['address'] == address_dict['address']:
fact['ipv4'] = address_dict
fact_address = address_dict['address']
break
if fact_address != interface["address"]:
return _fail("Interface %s has incorrect IPv4 address" % device)

Expand Down

0 comments on commit 80eb1a1

Please sign in to comment.