ansible-collections / community.network

Ansible Community Network Collection
http://galaxy.ansible.com/community/network
Other
124 stars 89 forks source link

Connection local isn't supported for SROS #510

Closed indirakas closed 1 year ago

indirakas commented 1 year ago
SUMMARY

We upgraded ansible to the latest version 2.12, which broke sros_command module in the task with the following error: "connection local support for this module has been removed use either 'network_cli' or 'ansible.netcommon.network_cli' connection" However, when I tried switching to the connection: network_cli, which also involved setting ansible_network_os, I realized that sros isn't supported, based on this: https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#settings-by-platform So which connection should I use for SROS?

ISSUE TYPE
COMPONENT NAME

community.network.sros_command

ANSIBLE VERSION
ansible [core 2.12.9]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.8/site-packages/ansible
  ansible collection location = /home/runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.8.13 (default, Jun 14 2022, 17:49:07) [GCC 8.5.0 20210514 (Red Hat 8.5.0-13)]
  jinja version = 2.11.3
  libyaml = True
COLLECTION VERSION
collections:
  - community.general
  - community.network
  - ansible.netcommon
  - ansible.utils
  - ansible.netcommon
  - ansible.network
  - ansible.posix
  - ansible.security
  - ansible.utils
  - ansible.windows
  - ansible.yang
  - servicenow.servicenow
  - nokia.sros
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
playbook:
- name: Get-config-nokia
  hosts: nokia
  connection: local
  gather_facts: no
  roles:
    - get-config-nokia

task in a role:
    - name: Collect show debug
      community.network.sros_command:
        command: show debug
      register: show_debug
vars:
ansible_user: "ansible_networking"
EXPECTED RESULTS

it was supposed to pull show debug output

ACTUAL RESULTS
TASK [get-config-nokia : Collect show debug] ***********************************
task path: /runner/project/roles/get-config-nokia/tasks/main.yml:6
fatal: [***]: FAILED! => {
    "changed": false,
    "msg": "connection local support for this module has been removed use either 'network_cli' or 'ansible.netcommon.network_cli' connection"
}
Andersson007 commented 1 year ago

@indirakas hello, thanks for reporting this issue

Andersson007 commented 1 year ago

@ganeshrn hi, could you please take a look? I see you added the deprecation in https://github.com/ansible-collections/community.network/pull/120 which was finally implemented by @felixfontein in https://github.com/ansible-collections/community.network/pull/440.

@indirakas for now, you can install community.network 3.3.1 where the feature was present, run:

ansible-galaxy collection install community.network:==3.3.1
felixfontein commented 1 year ago

However, when I tried switching to the connection: network_cli, which also involved setting ansible_network_os, I realized that sros isn't supported, based on this: https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#settings-by-platform

It could be that it works, but that the docs were never updated.

indirakas commented 1 year ago

However, when I tried switching to the connection: network_cli, which also involved setting ansible_network_os, I realized that sros isn't supported, based on this: https://docs.ansible.com/ansible/latest/network/user_guide/platform_index.html#settings-by-platform

It could be that it works, but that the docs were never updated.

I tried it with network_cli and sros as ansible_network_os, but then the error was:

PLAY [Get-config-nokia] ********************************************************
META: ran handlers
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
redirecting (type: terminal) ansible.builtin.sros to community.network.sros

TASK [get-config-nokia : Collect show debug] ***********************************
task path: /runner/project/roles/get-config-nokia/tasks/main.yml:6
The full traceback is:
Traceback (most recent call last):
  File "/usr/share/ansible/collections/ansible_collections/ansible/netcommon/plugins/plugin_utils/connection_base.py", line 58, in __getattr__
    return self.__dict__[name]
KeyError: '_nonetype'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/ansible/executor/task_executor.py", line 985, in _set_plugin_options
    plugin = getattr(self._connection, '_%s' % plugin_type)
  File "/usr/share/ansible/collections/ansible_collections/ansible/netcommon/plugins/plugin_utils/connection_base.py", line 66, in __getattr__
    raise AttributeError(
AttributeError: 'Connection' object has no attribute '_nonetype'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/ansible/collections/ansible_collections/ansible/netcommon/plugins/plugin_utils/connection_base.py", line 58, in __getattr__
    return self.__dict__[name]
KeyError: 'nonetype'
indirakas commented 1 year ago

@ganeshrn hi, could you please take a look? I see you added the deprecation in #120 which was finally implemented by @felixfontein in #440.

@indirakas for now, you can install community.network 3.3.1 where the feature was present, run:

ansible-galaxy collection install community.network:==3.3.1

@Andersson007 So we did downgrade to version 3.3.1 as you suggested:

# /home/runner/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
ansible.netcommon 4.1.0
ansible.utils     2.8.0
community.network 3.3.1

but I am getting the same error still:

TASK [get-config-nokia : Collect show debug] ***********************************
task path: /runner/project/roles/get-config-nokia/tasks/main.yml:6
fatal: [lbnl59-cr6]: FAILED! => {
"changed": false,
"msg": "connection local support for this module has been removed use either 'network_cli' or 'ansible.netcommon.network_cli' connection"
}
bekilas commented 1 year ago

Hello sir, Could you fix that problem?

indirakas commented 1 year ago

@Andersson007 Any update?

Andersson007 commented 1 year ago

@Andersson007 Any update?

@indirakas i'm not a maintainer of the collection's content, so I can't fix it myself. I can help with reviewing (general things, not testing), maintaining CI and releasing the collection.

Unfortunately original stuff's authors/maintainers in most cases do not respond. The stuff needs community maintainers and any help is welcome. We have the Quick-start guide to help newcomers to submit their first pull requests. We'd be happy to answer any questions about contributing to the community collections.

JCTechSol commented 1 year ago

This PR should address this issue https://github.com/ansible-collections/ansible.netcommon/pull/569

Andersson007 commented 1 year ago

This PR should address this issue ansible-collections/ansible.netcommon#569

@JCTechSol thanks for the info! Closing this one. Feel free to reopen if the merged PR didn't solve the issue