From 1068aa3ce7bb74a1f8455d1f8224aee9fc098be3 Mon Sep 17 00:00:00 2001 From: Sean Cavanaugh Date: Wed, 1 Nov 2017 05:26:38 -0400 Subject: [PATCH] Fixing nxos_vlan to match platform agnostic net_vlan part2 (#32410) * adding active and suspend to state to match net_vlan module although this is backwards compatible (for now) * removing bad config * getting rid of bad yml syntax --- lib/ansible/modules/network/nxos/nxos_vlan.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/network/nxos/nxos_vlan.py b/lib/ansible/modules/network/nxos/nxos_vlan.py index dacccf4c3b7..75f8dfc513c 100644 --- a/lib/ansible/modules/network/nxos/nxos_vlan.py +++ b/lib/ansible/modules/network/nxos/nxos_vlan.py @@ -48,7 +48,7 @@ options: vlan_state: description: - Manage the vlan operational state of the VLAN - (equivalent to state {active | suspend} command. + This is being deprecated in favor of state. required: false default: active choices: ['active','suspend'] @@ -69,9 +69,10 @@ options: state: description: - Manage the state of the resource. + Active and Suspend will assume the vlan is present. required: false default: present - choices: ['present','absent'] + choices: ['present','absent', 'active', 'suspend'] mode: description: - Set VLAN mode to classical ethernet or fabricpath. @@ -286,9 +287,10 @@ def main(): name=dict(required=False), vlan_state=dict(choices=['active', 'suspend'], required=False), mapped_vni=dict(required=False, type='str'), - state=dict(choices=['present', 'absent'], default='present', required=False), + state=dict(choices=['present', 'absent', 'active', 'suspend'], default='present', required=False), admin_state=dict(choices=['up', 'down'], required=False), mode=dict(choices=['ce', 'fabricpath'], required=False), + ) argument_spec.update(nxos_argument_spec) @@ -309,6 +311,13 @@ def main(): admin_state = module.params['admin_state'] mapped_vni = module.params['mapped_vni'] state = module.params['state'] + + # this allows vlan_state to remain backwards compatible as we move towards + # pushing all 4 options into state to match net_vlan + if state == 'active' or state == 'suspend': + vlan_state = module.params['state'] + state = 'present' + mode = module.params['mode'] if vlan_id: