Skip to content

Commit

Permalink
make eos_vlan idempotent (ansible#34443)
Browse files Browse the repository at this point in the history
Signed-off-by: Trishna Guha <[email protected]>
  • Loading branch information
trishnaguha authored Jan 4, 2018
1 parent ab67539 commit 0f24199
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/ansible/modules/network/eos/eos_vlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ def map_obj_to_commands(updates, module):
elif state == 'present':
if not obj_in_have:
commands.append('vlan %s' % w['vlan_id'])
commands.append('name %s' % w['name'])
if w['name']:
commands.append('name %s' % w['name'])

if w['interfaces']:
for i in w['interfaces']:
Expand Down Expand Up @@ -172,13 +173,15 @@ def map_obj_to_commands(updates, module):
else:
if not obj_in_have:
commands.append('vlan %s' % w['vlan_id'])
commands.append('name %s' % w['name'])
if w['name']:
commands.append('name %s' % w['name'])
commands.append('state %s' % w['state'])
elif obj_in_have['name'] != w['name'] or obj_in_have['state'] != w['state']:
elif (w['name'] and obj_in_have['name'] != w['name']) or obj_in_have['state'] != w['state']:
commands.append('vlan %s' % w['vlan_id'])

if obj_in_have['name'] != w['name']:
commands.append('name %s' % w['name'])
if w['name']:
if obj_in_have['name'] != w['name']:
commands.append('name %s' % w['name'])

if obj_in_have['state'] != w['state']:
commands.append('state %s' % w['state'])
Expand Down

0 comments on commit 0f24199

Please sign in to comment.