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

nxos_portchannel : module not idempotent for N1 images #31056

Closed
rahushen opened this Issue Sep 28, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@rahushen
Contributor

rahushen commented Sep 28, 2017

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • nxos_portchannel
ANSIBLE VERSION
ansible 2.4.0.0 (detached HEAD d14467b029) last updated 2017/09/28 11:09:55 (GMT -400)
  config file = None
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /root/agents-ci/ansible/lib/ansible
  executable location = /root/agents-ci/ansible/bin/ansible
  python version = 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4]
CONFIGURATION
OS / ENVIRONMENT

Ubuntu 14.04

SUMMARY

Output of show port-channel summary | json returns group as int as compared to a string on other platforms. This causes idempotence issues on N1 images. The fix is to check for both string and int equality.

STEPS TO REPRODUCE
  - name: Configure port-channel mode active
    nxos_portchannel: &configpc
      group: 99
      members: ["{{ testint1 }}", "{{ testint2 }}"]
      mode: active
      force: 'true'
      state: present
      timeout: 60
      provider: "{{ connection }}"
    register: result

  - assert: &true
      that:
        - "result.changed == true"

  - name: Check Idempotence
    nxos_portchannel: *configpc
    register: result

  - assert: &false
      that:
        - "result.changed == false"
EXPECTED RESULTS

Playbook should pass

ACTUAL RESULTS
TASK [nxos_portchannel : Check Idempotence] ***************************************************************************************************************
task path: /root/agents-ci/ansible/test/integration/targets/nxos_portchannel/tests/cli/sanity.yaml:53
<n5k-xxx.example.com> connection transport is cli
<n5k-xxx.example.com> using connection plugin network_cli
<n5k-xxx.example.com> socket_path: /root/.ansible/pc/1b4e3e6315
Using module file /root/agents-ci/ansible/lib/ansible/modules/network/nxos/nxos_portchannel.py
<n5k-xxx.example.com> ESTABLISH LOCAL CONNECTION FOR USER: root
<n5k-xxx.example.com> EXEC /bin/sh -c 'echo ~ && sleep 0'
<n5k-xxx.example.com> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1506024860.42-117137983875574 `" && echo ansible-tmp-1506024860.42-117137983875574="` echo /root/.ansible/tmp/ansible-tmp-1506024860.42-117137983875574 `" ) && sleep 0'
<n5k-xxx.example.com> PUT /tmp/tmppVH_PM TO /root/.ansible/tmp/ansible-tmp-1506024860.42-117137983875574/nxos_portchannel.py
<n5k-xxx.example.com> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1506024860.42-117137983875574/ /root/.ansible/tmp/ansible-tmp-1506024860.42-117137983875574/nxos_portchannel.py && sleep 0'
<n5k-xxx.example.com> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1506024860.42-117137983875574/nxos_portchannel.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1506024860.42-117137983875574/" > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_uvmlWf/ansible_module_nxos_portchannel.py", line 498, in <module>
    main()
  File "/tmp/ansible_uvmlWf/ansible_module_nxos_portchannel.py", line 481, in main
    commands = state_present(module, existing, proposed, interface_exist, force, warnings)
  File "/tmp/ansible_uvmlWf/ansible_module_nxos_portchannel.py", line 408, in state_present
    command = get_commands_to_add_members(proposed, existing, force, module)
  File "/tmp/ansible_uvmlWf/ansible_module_nxos_portchannel.py", line 300, in get_commands_to_add_members
    existing['group'], force, proposed['mode']))
KeyError: 'group'
FAILED! => {
    "changed": false, 
    "failed": true, 
    "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_uvmlWf/ansible_module_nxos_portchannel.py\", line 498, in <module>\n    main()\n  File \"/tmp/ansible_uvmlWf/ansible_module_nxos_portchannel.py\", line 481, in main\n    commands = state_present(module, existing, proposed, interface_exist, force, warnings)\n  File \"/tmp/ansible_uvmlWf/ansible_module_nxos_portchannel.py\", line 408, in state_present\n    command = get_commands_to_add_members(proposed, existing, force, module)\n  File \"/tmp/ansible_uvmlWf/ansible_module_nxos_portchannel.py\", line 300, in get_commands_to_add_members\n    existing['group'], force, proposed['mode']))\nKeyError: 'group'\n",  
    "module_stdout": "", 
    "msg": "MODULE FAILURE",  
    "rc": 0
}

rahushen added a commit to rahushen/ansible that referenced this issue Sep 28, 2017

@ansibot

This comment has been minimized.

Show comment
Hide comment

@s-hertel s-hertel removed the needs_triage label Sep 29, 2017

trishnaguha added a commit to trishnaguha/ansible that referenced this issue Oct 13, 2017

Fixes #31056 (#31057)
(cherry picked from commit 046d430)

trishnaguha added a commit that referenced this issue Oct 13, 2017

BondAnthony added a commit to BondAnthony/ansible that referenced this issue Oct 14, 2017

mtb-xt added a commit to mtb-xt/ansible that referenced this issue Oct 15, 2017

abadger added a commit that referenced this issue Oct 26, 2017

Fixes #31056 (#31057)
(cherry picked from commit 046d430)

@ansibot ansibot added bug and removed bug_report labels Mar 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment