Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nxos action plugin for nxos_install_os #53768

Merged
merged 2 commits into from Mar 18, 2019

Conversation

@mikewiebe
Copy link
Contributor

mikewiebe commented Mar 13, 2019

SUMMARY

Fixes #52206

  • Fix checks the connection type before attempting to determine the current values for PERSISTENT_COMMAND_TIMEOUT and PERSISTENT_CONNECT_TIMEOUT
  • Adds additional debug information to display the TIMEOUT values on failure.
  • Adds current timer values to the verbose -vvvv output.

NOTE: For connection: local (cli) or (nxapi) setting vars in the playbook task or passing via the -e argument have no effect. Setting environment variables or setting ansible.cfg however, do work.

I am open to suggestions about how we get playbook task vars to take effect for connection: local (cli) or (nxapi).

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

nxos_install_os

ADDITIONAL INFORMATION

The following tests were run to validate this fix.

CONNECTION: network_cli

  • TESTCASE: Timers NOT set
TASK [nxos_install_os : Install OS image nxos.7.0.3.I7.4.bin] ***************************************************************************************************************************************************************
task path: /Users/mwiebe/Projects/nxos_ansible/fix_ansible/test/integration/targets/nxos_install_os/tasks/upgrade/install_system.yaml:2
<n9k> attempting to start connection
<n9k> using connection plugin network_cli
<n9k> found existing local domain socket, using it!
<n9k> updating play_context for connection
<n9k> 
<n9k> local domain socket path is /Users/mwiebe/.ansible/pc/bcc36897f8
<n9k> PERSISTENT_COMMAND_TIMEOUT is 30
<n9k> PERSISTENT_CONNECT_TIMEOUT is 30
  • TESTCASE: Timers set using ENV vars
(py2-ansible) $env | grep ANSIBLE_PERS
ANSIBLE_PERSISTENT_COMMAND_TIMEOUT=600
ANSIBLE_PERSISTENT_CONNECT_TIMEOUT=600
TASK [nxos_install_os : Install OS image nxos.7.0.3.I7.4.bin] ***************************************************************************************************************************************************************
task path: /Users/mwiebe/Projects/nxos_ansible/fix_ansible/test/integration/targets/nxos_install_os/tasks/upgrade/install_system.yaml:2
<n9k> attempting to start connection
<n9k> using connection plugin network_cli
<n9k> found existing local domain socket, using it!
<n9k> updating play_context for connection
<n9k> 
<n9k> local domain socket path is /Users/mwiebe/.ansible/pc/4ac6359588
<n9k> PERSISTENT_COMMAND_TIMEOUT is 600
<n9k> PERSISTENT_CONNECT_TIMEOUT is 600
  • TESTCASE: Timers set using ansible.cfg
$cat /etc/ansible/ansible.cfg 
[persistent_connection]
connect_timeout=800
command_timeout=800
TASK [nxos_install_os : Install OS image nxos.7.0.3.I7.4.bin] ***************************************************************************************************************************************************************
task path: /Users/mwiebe/Projects/nxos_ansible/fix_ansible/test/integration/targets/nxos_install_os/tasks/upgrade/install_system.yaml:2
<n9k> attempting to start connection
<n9k> using connection plugin network_cli
<n9k> found existing local domain socket, using it!
<n9k> updating play_context for connection
<n9k> 
<n9k> local domain socket path is /Users/mwiebe/.ansible/pc/c700b6b398
<n9k> PERSISTENT_COMMAND_TIMEOUT is 800
<n9k> PERSISTENT_CONNECT_TIMEOUT is 800
  • TESTCASE: Timers set using vars in playbook task
- name: "Install OS image {{ si }}"
  check_mode: "{{ checkmode }}"
  nxos_install_os:
    system_image_file: "{{ si }}"
    issu: "{{ issu }}"
    provider: "{{ connection }}"
  vars:
    ansible_command_timeout: 700
    ansible_connect_timeout: 700
TASK [nxos_install_os : Install OS image nxos.7.0.3.I7.4.bin] ***************************************************************************************************************************************************************
task path: /Users/mwiebe/Projects/nxos_ansible/fix_ansible/test/integration/targets/nxos_install_os/tasks/upgrade/install_system.yaml:2
<n9k> attempting to start connection
<n9k> using connection plugin network_cli
<n9k> found existing local domain socket, using it!
<n9k> updating play_context for connection
<n9k> 
<n9k> local domain socket path is /Users/mwiebe/.ansible/pc/e8335c6594
<n9k> PERSISTENT_COMMAND_TIMEOUT is 700
<n9k> PERSISTENT_CONNECT_TIMEOUT is 700
  • TESTCASE: Timers set by passing them in to ansible-playbook using -e option

ansible-playbook nxos.yaml -e "ansible_command_timeout=1000 ansible_connect_timeout=900"

TASK [nxos_install_os : Install OS image nxos.7.0.3.I7.4.bin] ***************************************************************************************************************************************************************
task path: /Users/mwiebe/Projects/nxos_ansible/fix_ansible/test/integration/targets/nxos_install_os/tasks/upgrade/install_system.yaml:2
<n9k> attempting to start connection
<n9k> using connection plugin network_cli
<n9k> found existing local domain socket, using it!
<n9k> updating play_context for connection
<n9k> 
<n9k> local domain socket path is /Users/mwiebe/.ansible/pc/01ee8deb61
<n9k> PERSISTENT_COMMAND_TIMEOUT is 1000
<n9k> PERSISTENT_CONNECT_TIMEOUT is 900

CONNECTION: httpapi

  • TESTCASE: Timers NOT set
TASK [nxos_install_os : Install OS image nxos.7.0.3.I7.4.bin] ***************************************************************************************************************************************************************
task path: /Users/mwiebe/Projects/nxos_ansible/fix_ansible/test/integration/targets/nxos_install_os/tasks/upgrade/install_system.yaml:2
<n9k> attempting to start connection
<n9k> using connection plugin httpapi
<n9k> found existing local domain socket, using it!
<n9k> updating play_context for connection
<n9k> 
<n9k> local domain socket path is /Users/mwiebe/.ansible/pc/11c4d12331
<n9k> PERSISTENT_COMMAND_TIMEOUT is 30
<n9k> PERSISTENT_CONNECT_TIMEOUT is 30
  • TESTCASE: Timers set using ENV vars
(py2-ansible) $env | grep ANSIBLE_PERS
ANSIBLE_PERSISTENT_COMMAND_TIMEOUT=600
ANSIBLE_PERSISTENT_CONNECT_TIMEOUT=600
TASK [nxos_install_os : Install OS image nxos.7.0.3.I7.4.bin] ***************************************************************************************************************************************************************
task path: /Users/mwiebe/Projects/nxos_ansible/fix_ansible/test/integration/targets/nxos_install_os/tasks/upgrade/install_system.yaml:2
<n9k> attempting to start connection
<n9k> using connection plugin httpapi
<n9k> found existing local domain socket, using it!
<n9k> updating play_context for connection
<n9k> 
<n9k> local domain socket path is /Users/mwiebe/.ansible/pc/0606e69189
<n9k> PERSISTENT_COMMAND_TIMEOUT is 600
<n9k> PERSISTENT_CONNECT_TIMEOUT is 600
  • TESTCASE: Timers set using ansible.cfg
$cat /etc/ansible/ansible.cfg 
[persistent_connection]
connect_timeout=800
command_timeout=800
TASK [nxos_install_os : Install OS image nxos.7.0.3.I7.4.bin] ***************************************************************************************************************************************************************
task path: /Users/mwiebe/Projects/nxos_ansible/fix_ansible/test/integration/targets/nxos_install_os/tasks/upgrade/install_system.yaml:2
<n9k> attempting to start connection
<n9k> using connection plugin httpapi
<n9k> found existing local domain socket, using it!
<n9k> updating play_context for connection
<n9k> 
<n9k> local domain socket path is /Users/mwiebe/.ansible/pc/9012e40de0
<n9k> PERSISTENT_COMMAND_TIMEOUT is 800
<n9k> PERSISTENT_CONNECT_TIMEOUT is 800
  • TESTCASE: Timers set using vars in playbook task
- name: "Install OS image {{ si }}"
  check_mode: "{{ checkmode }}"
  nxos_install_os:
    system_image_file: "{{ si }}"
    issu: "{{ issu }}"
    provider: "{{ connection }}"
  vars:
    ansible_command_timeout: 700
    ansible_connect_timeout: 700
TASK [nxos_install_os : Install OS image nxos.7.0.3.I7.4.bin] ***************************************************************************************************************************************************************
task path: /Users/mwiebe/Projects/nxos_ansible/fix_ansible/test/integration/targets/nxos_install_os/tasks/upgrade/install_system.yaml:2
<n9k> attempting to start connection
<n9k> using connection plugin httpapi
<n9k> found existing local domain socket, using it!
<n9k> updating play_context for connection
<n9k> 
<n9k> local domain socket path is /Users/mwiebe/.ansible/pc/b9d0d42858
<n9k> PERSISTENT_COMMAND_TIMEOUT is 700
<n9k> PERSISTENT_CONNECT_TIMEOUT is 700
  • TESTCASE: Timers set by passing them in to ansible-playbook using -e option

ansible-playbook nxos.yaml -e "ansible_command_timeout=1000 ansible_connect_timeout=900"

TASK [nxos_install_os : Install OS image nxos.7.0.3.I7.4.bin] ***************************************************************************************************************************************************************
task path: /Users/mwiebe/Projects/nxos_ansible/fix_ansible/test/integration/targets/nxos_install_os/tasks/upgrade/install_system.yaml:2
<n9k> attempting to start connection
<n9k> using connection plugin httpapi
<n9k> found existing local domain socket, using it!
<n9k> updating play_context for connection
<n9k> 
<n9k> local domain socket path is /Users/mwiebe/.ansible/pc/8bf7088d5a
<n9k> PERSISTENT_COMMAND_TIMEOUT is 1000
<n9k> PERSISTENT_CONNECT_TIMEOUT is 900

CONNECTION: local (cli)

  • TESTCASE: Timers NOT set
TASK [nxos_install_os : Install OS image nxos.7.0.3.I7.4.bin] ***************************************************************************************************************************************************************
task path: /Users/mwiebe/Projects/nxos_ansible/fix_ansible/test/integration/targets/nxos_install_os/tasks/upgrade/install_system.yaml:2
<n9k> PERSISTENT_COMMAND_TIMEOUT is 30
<n9k> PERSISTENT_CONNECT_TIMEOUT is 30
  • TESTCASE: Timers set using ENV vars
(py2-ansible) $env | grep ANSIBLE_PERS
ANSIBLE_PERSISTENT_COMMAND_TIMEOUT=600
ANSIBLE_PERSISTENT_CONNECT_TIMEOUT=600
TASK [nxos_install_os : Install OS image nxos.7.0.3.I7.4.bin] ***************************************************************************************************************************************************************
task path: /Users/mwiebe/Projects/nxos_ansible/fix_ansible/test/integration/targets/nxos_install_os/tasks/upgrade/install_system.yaml:2
<n9k> PERSISTENT_COMMAND_TIMEOUT is 600
<n9k> PERSISTENT_CONNECT_TIMEOUT is 600
  • TESTCASE: Timers set using ansible.cfg
$cat /etc/ansible/ansible.cfg 
[persistent_connection]
connect_timeout=800
command_timeout=800
TASK [nxos_install_os : Install OS image nxos.7.0.3.I7.4.bin] ***************************************************************************************************************************************************************
task path: /Users/mwiebe/Projects/nxos_ansible/fix_ansible/test/integration/targets/nxos_install_os/tasks/upgrade/install_system.yaml:2
<n9k> PERSISTENT_COMMAND_TIMEOUT is 800
<n9k> PERSISTENT_CONNECT_TIMEOUT is 800
  • TESTCASE: Timers set using vars in playbook task - FAILED
- name: "Install OS image {{ si }}"
  check_mode: "{{ checkmode }}"
  nxos_install_os:
    system_image_file: "{{ si }}"
    issu: "{{ issu }}"
    provider: "{{ connection }}"
  vars:
    ansible_command_timeout: 700
    ansible_connect_timeout: 700
TASK [nxos_install_os : Install OS image nxos.7.0.3.I7.4.bin] ***************************************************************************************************************************************************************
task path: /Users/mwiebe/Projects/nxos_ansible/fix_ansible/test/integration/targets/nxos_install_os/tasks/upgrade/install_system.yaml:2
<n9k> PERSISTENT_COMMAND_TIMEOUT is 30
<n9k> PERSISTENT_CONNECT_TIMEOUT is 30
  • TESTCASE: Timers set by passing them in to ansible-playbook using -e option - FAILED

ansible-playbook nxos.yaml -e "ansible_command_timeout=1000 ansible_connect_timeout=900"

TASK [nxos_install_os : Install OS image nxos.7.0.3.I7.4.bin] ***************************************************************************************************************************************************************
task path: /Users/mwiebe/Projects/nxos_ansible/fix_ansible/test/integration/targets/nxos_install_os/tasks/upgrade/install_system.yaml:2
<n9k> PERSISTENT_COMMAND_TIMEOUT is 30
<n9k> PERSISTENT_CONNECT_TIMEOUT is 30

CONNECTION: local (nxapi)

  • Same results as CONNECTION: local (cli)
@ansibot

This comment has been minimized.

connection = self._connection
if connection.get_option('persistent_command_timeout') < 600 or connection.get_option('persistent_connect_timeout') < 600:
if connection.transport == 'local':

This comment has been minimized.

@trishnaguha

trishnaguha Mar 14, 2019

Member

@mikewiebe Can you update the module docs which states, if someone wants to set the timeouts as config task variable network_cli/httpapi connection plugin is required. local only supports these timeout values with ansible.cfg or env var.

This comment has been minimized.

@mikewiebe

mikewiebe Mar 14, 2019

Author Contributor

Yes, I can do that.

@ansibot

This comment has been minimized.

@ansibot ansibot added the module label Mar 14, 2019

@mikewiebe mikewiebe force-pushed the mikewiebe-ansible:rel280/fix_nxos_install_os branch from 7e1bd7c to ffa85c1 Mar 15, 2019

@mikewiebe

This comment has been minimized.

Copy link
Contributor Author

mikewiebe commented Mar 15, 2019

@trishnaguha Can we go ahead and merge this?

@trishnaguha
Copy link
Member

trishnaguha left a comment

Thanks @mikewiebe

@trishnaguha trishnaguha merged commit 4c2a3bf into ansible:devel Mar 18, 2019

1 check passed

Shippable Run 114145 status is SUCCESS.
Details

@trishnaguha trishnaguha added this to Needs Triage in Networking via automation Mar 18, 2019

catcombo added a commit to catcombo/ansible that referenced this pull request Mar 21, 2019

Fix nxos action plugin for nxos_install_os (ansible#53768)
* Fix nxos action plugin for nxos_install_os

* Update module docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.