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

TerminalModule object has no attribute close #44

Open
mmMOLINARI opened this issue Nov 29, 2021 · 0 comments
Open

TerminalModule object has no attribute close #44

mmMOLINARI opened this issue Nov 29, 2021 · 0 comments

Comments

@mmMOLINARI
Copy link
Contributor

mmMOLINARI commented Nov 29, 2021

Summary
When running a playbook with multiple tasks using loop to make vlan changes in a single RUCKUS ICX switch, sometimes I get the warning message 'TerminalModule' object has no attribute 'close'. The affected task completes, but I cannot explain the root cause. The message is triggered by the TerminalModule class, invoked by the icx.py module.

Issue Type
Bug Report

Component Name
TerminalModule class in icx.py

Ansible Version
$ ansible --version
ansible 2.10.15
config file = /etc/ansible/ansible.cfg
configured module search path = ['/etc/ansible/moduless']
ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0]

Configuration
$ ansible-config dump --only-changed
ANSIBLE_SSH_ARGS(/etc/ansible/ansible.cfg) = -o ControlMaster=auto -o ControlPersist=3600s -o PreferredAuth
ANSIBLE_SSH_CONTROL_PATH_DIR(/etc/ansible/ansible.cfg) = ~/.ansible/cp
DEFAULT_CALLBACK_WHITELIST(/etc/ansible/ansible.cfg) = ['profile_tasks']
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = ['/etc/ansible/hosts']
DEFAULT_MODULE_PATH(/etc/ansible/ansible.cfg) = ['/etc/ansible/moduless']
DEFAULT_STDOUT_CALLBACK(/etc/ansible/ansible.cfg) = debug
DEFAULT_TRANSPORT(/etc/ansible/ansible.cfg) = network_cli
INTERPRETER_PYTHON(/etc/ansible/ansible.cfg) = auto_silent
PARAMIKO_HOST_KEY_AUTO_ADD(/etc/ansible/ansible.cfg) = True
PERSISTENT_COMMAND_TIMEOUT(/etc/ansible/ansible.cfg) = 60
PERSISTENT_CONNECT_TIMEOUT(/etc/ansible/ansible.cfg) = 30
SYSTEM_WARNINGS(/etc/ansible/ansible.cfg) = False

OS / Environment
Ubuntu 18.04.3 LTS
Playbook using the commscope.icx galaxy collection running against RUCKUS ICX switch, software release 9.0.00

Steps to Reproduce
Install the collection using ansible-galaxy collection install commscope.icx. Run the playbook below against a single ICX switch. Even when the switch is local to the Ansible server, with no network delays, sometimes the warning message 'TerminalModule' object has no attribute 'close' shows during a task execution:

image

The rate for this error is around 1% of the executed tasks.
icx.py contains a class used by many vendors (the module uses different names for each vendor). icx.py seems to take care of opening and closing a terminal session, reporting error messages and moving to privilege escalation.

Playbook used in tests

---
- hosts: all
  gather_facts: no
  vars:
    ansible_network_os: commscope.icx.icx
    ansible_become: yes
    ansible_become_method: enable
    ansible_user: admin
    ansible_password: password
    ansible_buffer_read_timeout: .3
    vlans:
      - name: backbone
        vlan_id: 10
      - name: metro
        vlan_id: 20
      - name: access
        vlan_id: 30
      - name: aggregation
        vlan_id: 40
      - name: internet
        vlan_id: 50
      - name: backbone
        vlan_id: 10
      - name: metro
        vlan_id: 20
      - name: access
        vlan_id: 30
      - name: aggregation
        vlan_id: 40
      - name: internet
        vlan_id: 50
  tasks:
   - name: 1 - create vlan with tagged ports
     commscope.icx.icx_vlan:
       name: '{{ item.name }}'
       check_running_config: True
       vlan_id: '{{ item.vlan_id }}'
       tagged:
         name: 
            - ethernet 1/2/1
            - ethernet 1/3/1
     loop: "{{ vlans }}"
     tags: always

   - name: 2 - change vlan name
     commscope.icx.icx_vlan:
       name: wireless
       check_running_config: True
       vlan_id: '{{ item.vlan_id }}'
     loop: "{{ vlans }}"
     tags: always

   - name: 4 - add tagged ports to existing vlan
     commscope.icx.icx_vlan:
       name: internet
       check_running_config: True
       vlan_id: '{{ item.vlan_id }}'
       tagged:
         name: 
          - ethernet 1/3/2
     loop: "{{ vlans }}"
     tags: always

   - name: 5 - purge all ports from existing vlan, except the ports that are listed
     commscope.icx.icx_vlan:
       name: internet
       check_running_config: True
       vlan_id: '{{ item.vlan_id }}'
       tagged:
         name: 
           - ethernet 1/3/2
         purge: True
     loop: "{{ vlans }}"
     tags: always

   - name: 6 - add ports to existing vlan using aggregate
     commscope.icx.icx_vlan:
       check_running_config: True
       aggregate:
         - {vlan_id: '20', name: internet, tagged: {name: ethernet 1/2/1}}
     loop: "{{ vlans }}"
     tags: always

   - name: 8 - configure 802-1w
     commscope.icx.icx_vlan:
       check_running_config: True
       vlan_id: '{{ item.vlan_id }}'
       stp:
         type: 802-1w
         priority: 128
         enabled: True
     loop: "{{ vlans }}"
     tags: always

   - name: 9 - Remove 802-1w
     commscope.icx.icx_vlan:
       check_running_config: True
       vlan_id: '{{ item.vlan_id }}'
       stp:
         type: 802-1w
         enabled: False
     loop: "{{ vlans }}"
     tags: always

   - name: 10 - add lag to existing vlan
     commscope.icx.icx_vlan:
       check_running_config: True
       vlan_id: '{{ item.vlan_id }}'      
       tagged:
         name: 
           - lag 10
     loop: "{{ vlans }}"
     tags: always

   - name: 11 - create 3 vlans using aggregate
     commscope.icx.icx_vlan:
       check_running_config: True
       aggregate:
         - {vlan_id: '60', tagged: {name: ethernet 1/1/9}}
         - {vlan_id: '70', tagged: {name: ethernet 1/1/9}}
     loop: "{{ vlans }}"
     tags: always

   - name: 12 - purge all vlans, except the ones listed
     commscope.icx.icx_vlan:
       check_running_config: True
       vlan_id: '{{ item.vlan_id }}'
       purge: True
     loop: "{{ vlans }}"
     tags: always

   - name: 13 - remove vlan entirely
     commscope.icx.icx_vlan:
       check_running_config: True
       vlan_id: '{{ item.vlan_id }}'
       state: absent
     loop: "{{ vlans }}"
     tags: always

Expected Results
Do not see any warning messages

Actual Results
Sometimes the warning message 'TerminalModule' object has no attribute 'close' shows during a task execution. See details in section Steps to Reproduce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant