mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 03:00:23 -07:00
Refactor nxos_reboot module (#24484)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
fd1debb869
commit
3d51081a59
2 changed files with 5 additions and 12 deletions
|
@ -59,7 +59,7 @@ rebooted:
|
||||||
sample: true
|
sample: true
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.nxos import get_config, load_config, run_commands
|
from ansible.module_utils.nxos import run_commands
|
||||||
from ansible.module_utils.nxos import nxos_argument_spec, check_args
|
from ansible.module_utils.nxos import nxos_argument_spec, check_args
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
@ -71,28 +71,22 @@ def reboot(module):
|
||||||
]
|
]
|
||||||
run_commands(module, cmds)
|
run_commands(module, cmds)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
argument_spec = {}
|
argument_spec = {}
|
||||||
argument_spec.update(nxos_argument_spec)
|
argument_spec.update(nxos_argument_spec)
|
||||||
|
|
||||||
module = AnsibleModule(argument_spec=argument_spec,
|
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
|
||||||
supports_check_mode=True)
|
|
||||||
|
|
||||||
warnings = list()
|
warnings = list()
|
||||||
check_args(module, warnings)
|
check_args(module, warnings)
|
||||||
|
results = dict(changed=False, warnings=warnings)
|
||||||
|
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
reboot(module)
|
reboot(module)
|
||||||
changed = True
|
results['changed'] = True
|
||||||
|
|
||||||
results = {
|
|
||||||
'changed': True,
|
|
||||||
'warnings': warnings
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exit_json(**results)
|
module.exit_json(**results)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
|
@ -518,7 +518,6 @@ lib/ansible/modules/network/nxos/nxos_pim_interface.py
|
||||||
lib/ansible/modules/network/nxos/nxos_pim_rp_address.py
|
lib/ansible/modules/network/nxos/nxos_pim_rp_address.py
|
||||||
lib/ansible/modules/network/nxos/nxos_ping.py
|
lib/ansible/modules/network/nxos/nxos_ping.py
|
||||||
lib/ansible/modules/network/nxos/nxos_portchannel.py
|
lib/ansible/modules/network/nxos/nxos_portchannel.py
|
||||||
lib/ansible/modules/network/nxos/nxos_reboot.py
|
|
||||||
lib/ansible/modules/network/nxos/nxos_smu.py
|
lib/ansible/modules/network/nxos/nxos_smu.py
|
||||||
lib/ansible/modules/network/nxos/nxos_snapshot.py
|
lib/ansible/modules/network/nxos/nxos_snapshot.py
|
||||||
lib/ansible/modules/network/nxos/nxos_snmp_community.py
|
lib/ansible/modules/network/nxos/nxos_snmp_community.py
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue