cleans up nxos_vlan output (#21807)

Only returns debug return keys when the debug flag is set
pull/21811/head
Peter Sprygada 8 years ago committed by GitHub
parent 0a62d7c1f4
commit 7b30203016

@ -107,36 +107,36 @@ RETURN = '''
proposed_vlans_list: proposed_vlans_list:
description: list of VLANs being proposed description: list of VLANs being proposed
returned: always returned: when debug enabled
type: list type: list
sample: ["100"] sample: ["100"]
existing_vlans_list: existing_vlans_list:
description: list of existing VLANs on the switch prior to making changes description: list of existing VLANs on the switch prior to making changes
returned: always returned: when debug enabled
type: list type: list
sample: ["1", "2", "3", "4", "5", "20"] sample: ["1", "2", "3", "4", "5", "20"]
end_state_vlans_list: end_state_vlans_list:
description: list of VLANs after the module is executed description: list of VLANs after the module is executed
returned: always returned: when debug enabled
type: list type: list
sample: ["1", "2", "3", "4", "5", "20", "100"] sample: ["1", "2", "3", "4", "5", "20", "100"]
proposed: proposed:
description: k/v pairs of parameters passed into module (does not include description: k/v pairs of parameters passed into module (does not include
vlan_id or vlan_range) vlan_id or vlan_range)
returned: always returned: when debug enabled
type: dict or null type: dict or null
sample: {"admin_state": "down", "name": "app_vlan", sample: {"admin_state": "down", "name": "app_vlan",
"vlan_state": "suspend", "mapped_vni": "5000"} "vlan_state": "suspend", "mapped_vni": "5000"}
existing: existing:
description: k/v pairs of existing vlan or null when using vlan_range description: k/v pairs of existing vlan or null when using vlan_range
returned: always returned: when debug enabled
type: dict type: dict
sample: {"admin_state": "down", "name": "app_vlan", sample: {"admin_state": "down", "name": "app_vlan",
"vlan_id": "20", "vlan_state": "suspend", "mapped_vni": ""} "vlan_id": "20", "vlan_state": "suspend", "mapped_vni": ""}
end_state: end_state:
description: k/v pairs of the VLAN after executing module or null description: k/v pairs of the VLAN after executing module or null
when using vlan_range when using vlan_range
returned: always returned: when debug enabled
type: dict or null type: dict or null
sample: {"admin_state": "down", "name": "app_vlan", "vlan_id": "20", sample: {"admin_state": "down", "name": "app_vlan", "vlan_id": "20",
"vlan_state": "suspend", "mapped_vni": "5000"} "vlan_state": "suspend", "mapped_vni": "5000"}
@ -145,12 +145,16 @@ updates:
returned: always returned: always
type: list type: list
sample: ["vlan 20", "vlan 55", "vn-segment 5000"] sample: ["vlan 20", "vlan 55", "vn-segment 5000"]
commands:
description: command string sent to the device
returned: always
type: list
sample: ["vlan 20", "vlan 55", "vn-segment 5000"]
changed: changed:
description: check to see if a change was made on the device description: check to see if a change was made on the device
returned: always returned: always
type: boolean type: boolean
sample: true sample: true
''' '''
from ansible.module_utils.nxos import get_config, load_config, run_commands from ansible.module_utils.nxos import get_config, load_config, run_commands
from ansible.module_utils.nxos import nxos_argument_spec, check_args from ansible.module_utils.nxos import nxos_argument_spec, check_args
@ -426,17 +430,22 @@ def main():
if vlan_id: if vlan_id:
end_state = get_vlan(vlan_id, module) end_state = get_vlan(vlan_id, module)
results = {} results = {
results['proposed_vlans_list'] = proposed_vlans_list 'commands': commands,
results['existing_vlans_list'] = existing_vlans_list 'updates': commands,
results['proposed'] = proposed 'changed': changed,
results['existing'] = existing 'warnings': warnings
results['end_state'] = end_state }
results['end_state_vlans_list'] = end_state_vlans_list
results['updates'] = commands if module._debug:
results['changed'] = changed results.update({
results['warnings'] = warnings 'proposed_vlans_list': proposed_vlans_list,
results['warnings'] = warnings 'existing_vlans_list': existing_vlans_list,
'proposed': proposed,
'existing': existing,
'end_state': end_state,
'end_state_vlans_list': end_state_vlans_list
})
module.exit_json(**results) module.exit_json(**results)

Loading…
Cancel
Save