1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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.
This commit is contained in:
Ganesh Nalawade 2017-12-25 18:11:35 +05:30 committed by GitHub
parent 89670133c1
commit 98f3424ed0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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: