Fix nxos action plugin for nxos_install_os (#53768)

* Fix nxos action plugin for nxos_install_os

* Update module docs
pull/53935/head
Mike Wiebe 6 years ago committed by Trishna Guha
parent 9308b2c8e0
commit 4c2a3bfed5

@ -38,6 +38,9 @@ notes:
- This module requires both the ANSIBLE_PERSISTENT_CONNECT_TIMEOUT and
ANSIBLE_PERSISTENT_COMMAND_TIMEOUT timers to be set to 600 seconds or higher.
The module will exit if the timers are not set properly.
- When using connection local, ANSIBLE_PERSISTENT_CONNECT_TIMEOUT and
ANSIBLE_PERSISTENT_COMMAND_TIMEOUT can only be set using ENV variables or
the ansible.cfg file.
- Do not include full file paths, just the name of the file(s) stored on
the top level flash directory.
- This module attempts to install the software immediately,

@ -55,10 +55,23 @@ class ActionModule(ActionNetworkModule):
self._task.args['username'] = self._play_context.connection_user
if self._task.action == 'nxos_install_os':
persistent_command_timeout = 0
persistent_connect_timeout = 0
connection = self._connection
if connection.get_option('persistent_command_timeout') < 600 or connection.get_option('persistent_connect_timeout') < 600:
if connection.transport == 'local':
persistent_command_timeout = C.PERSISTENT_COMMAND_TIMEOUT
persistent_connect_timeout = C.PERSISTENT_CONNECT_TIMEOUT
else:
persistent_command_timeout = connection.get_option('persistent_command_timeout')
persistent_connect_timeout = connection.get_option('persistent_connect_timeout')
display.vvvv('PERSISTENT_COMMAND_TIMEOUT is %s' % str(persistent_command_timeout), self._play_context.remote_addr)
display.vvvv('PERSISTENT_CONNECT_TIMEOUT is %s' % str(persistent_connect_timeout), self._play_context.remote_addr)
if persistent_command_timeout < 600 or persistent_connect_timeout < 600:
msg = 'PERSISTENT_COMMAND_TIMEOUT and PERSISTENT_CONNECT_TIMEOUT'
msg += ' must be set to 600 seconds or higher when using nxos_install_os module'
msg += ' must be set to 600 seconds or higher when using nxos_install_os module.'
msg += ' Current persistent_command_timeout setting:' + str(persistent_command_timeout)
msg += ' Current persistent_connect_timeout setting:' + str(persistent_connect_timeout)
return {'failed': True, 'msg': msg}
if self._play_context.connection in ('network_cli', 'httpapi'):

Loading…
Cancel
Save