Fix ios_l3_interface configure ipv4 address issue (#34222)

Adding a new interface and it's ipv4/ipv6 address results
in failure. Add a check to validate if interface address is
already configured or not.
pull/34227/head
Ganesh Nalawade 7 years ago committed by GitHub
parent 89670133c1
commit 98f3424ed0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -185,14 +185,14 @@ def map_obj_to_commands(updates, module):
elif state == 'present':
if ipv4:
if obj_in_have is None or ipv4 != obj_in_have['ipv4']:
if obj_in_have is None or obj_in_have.get('ipv4') is None or ipv4 != obj_in_have['ipv4']:
address = ipv4.split('/')
if len(address) == 2:
ipv4 = '{0} {1}'.format(address[0], to_netmask(address[1]))
commands.append('ip address {}'.format(ipv4))
if ipv6:
if obj_in_have is None or obj_in_have['ipv6'] is None or ipv6.lower() != obj_in_have['ipv6'].lower():
if obj_in_have is None or obj_in_have.get('ipv6') is None or ipv6.lower() != obj_in_have['ipv6'].lower():
commands.append('ipv6 address {}'.format(ipv6))
if commands[-1] == interface:

Loading…
Cancel
Save