Skip to content

Commit

Permalink
Fix nxos_l3_interfaces rendering of dhcp (ansible#66049)
Browse files Browse the repository at this point in the history
Signed-off-by: NilashishC <[email protected]>
  • Loading branch information
NilashishC authored Dec 24, 2019
1 parent abad4fb commit 94e0547
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from ansible.module_utils.network.common import utils
from ansible.module_utils.network.nxos.argspec.l3_interfaces.l3_interfaces import L3_interfacesArgs
from ansible.module_utils.network.nxos.utils.utils import get_interface_type, validate_ipv4_addr, validate_ipv6_addr
from ansible.module_utils.network.nxos.utils.utils import get_interface_type


class L3_interfacesFacts(object):
Expand Down Expand Up @@ -83,18 +83,16 @@ def render_config(self, spec, conf):
if get_interface_type(intf) == 'unknown':
return {}
config['name'] = intf

ipv4_match = re.compile(r'\n ip address (.*)')
matches = ipv4_match.findall(conf)
if matches:
if validate_ipv4_addr(matches[0]):
if matches[0]:
config['ipv4'] = []
for m in matches:
ipv4_conf = m.split()
addr = ipv4_conf[0]
ipv4_addr = addr if validate_ipv4_addr(addr) else None
if ipv4_addr:
config_dict = {'address': ipv4_addr}
if addr:
config_dict = {'address': addr}
if len(ipv4_conf) > 1:
d = ipv4_conf[1]
if d == 'secondary':
Expand All @@ -109,14 +107,13 @@ def render_config(self, spec, conf):
ipv6_match = re.compile(r'\n ipv6 address (.*)')
matches = ipv6_match.findall(conf)
if matches:
if validate_ipv6_addr(matches[0]):
if matches[0]:
config['ipv6'] = []
for m in matches:
ipv6_conf = m.split()
addr = ipv6_conf[0]
ipv6_addr = addr if validate_ipv6_addr(addr) else None
if ipv6_addr:
config_dict = {'address': ipv6_addr}
if addr:
config_dict = {'address': addr}
if len(ipv6_conf) > 1:
d = ipv6_conf[1]
if d == 'tag':
Expand Down

0 comments on commit 94e0547

Please sign in to comment.