dell / omsdk

Dell EMC OpenManage Python SDK
Apache License 2.0
57 stars 20 forks source link

Incompatible with pysnmp 6.2.4 #46

Open MallocArray opened 1 month ago

MallocArray commented 1 month ago

QwikContext

After upgrading pysnmp to 6.2.4, Ansible playbook using the dellemc.openmanage.idrac_system_info module fails with an error

Details

Previously had pysnmp 4.4.12 installed and playbook was working fine against iDRAC9 devices on 7.00 firmware. After upgrading pysnmp to the latest 6.2.4 release in our Execution Environment, the playbook fails with error related to omsdk and pysnmp

Repro Steps

Steps to reproduce the problem Ansible playbook

    - name: Get system inventory
      dellemc.openmanage.idrac_system_info:
        idrac_ip: "{{ ansible_host }}"  
        idrac_user: "{{ idrac_username }}"
        idrac_password: "{{ idrac_password }}"
        validate_certs: "{{ dell_validate_certs | default(omit) }}"
        ca_path: "{{ dell_ca_path | default(omit) }}"
      delegate_to: localhost
      tags: always
      register: idrac_system_info
      until: idrac_system_info is not failed
      retries: 0
      delay: 15

Impact

What areas, configurations and use cases does this issue impact Is there a data loss? Ansible playbook fails to run

NeedBy

When do you need this issue fixed Will attempt to find the minimal version of pysnmp that will works and pin our environment to that version until it can be full addressed

Severity

What is the severity of the issue. Unable to use omsdk based ansible playbooks

Error Message

TASK [Get system inventory] *******************************************************************************************
task path: /runner/Dell/idrac/idrac_configuration.yml:23
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c 'echo ~root && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1721674740.740452-903-140029397416120 `" && echo ansible-tmp-1721674740.740452-903-140029397416120="` echo /root/.ansible/tmp/ansible-tmp-1721674740.740452-903-140029397416120 `" ) && sleep 0'
Using module file /runner/collections/ansible_collections/dellemc/openmanage/plugins/modules/idrac_system_info.py
<localhost> PUT /root/.ansible/tmp/ansible-local-8692e_20hs7/tmpbrey9cjp TO /root/.ansible/tmp/ansible-tmp-1721674740.740452-903-140029397416120/AnsiballZ_idrac_system_info.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1721674740.740452-903-140029397416120/ /root/.ansible/tmp/ansible-tmp-1721674740.740452-903-140029397416120/AnsiballZ_idrac_system_info.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1721674740.740452-903-140029397416120/AnsiballZ_idrac_system_info.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1721674740.740452-903-140029397416120/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-tmp-1721674740.740452-903-140029397416120/AnsiballZ_idrac_system_info.py", line 107, in <module>
    _ansiballz_main()
  File "/root/.ansible/tmp/ansible-tmp-1721674740.740452-903-140029397416120/AnsiballZ_idrac_system_info.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/root/.ansible/tmp/ansible-tmp-1721674740.740452-903-140029397416120/AnsiballZ_idrac_system_info.py", line 47, in invoke_module
    runpy.run_module(mod_name='ansible_collections.dellemc.openmanage.plugins.modules.idrac_system_info', init_globals=dict(_module_fqn='ansible_collections.dellemc.openmanage.plugins.modules.idrac_system_info', _modlib_path=modlib_path),
  File "<frozen runpy>", line 226, in run_module
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "/tmp/ansible_dellemc.openmanage.idrac_system_info_payload_1qk0etkl/ansible_dellemc.openmanage.idrac_system_info_payload.zip/ansible_collections/dellemc/openmanage/plugins/modules/idrac_system_info.py", line 121, in <module>
  File "/tmp/ansible_dellemc.openmanage.idrac_system_info_payload_1qk0etkl/ansible_dellemc.openmanage.idrac_system_info_payload.zip/ansible_collections/dellemc/openmanage/plugins/modules/idrac_system_info.py", line 106, in main
  File "/tmp/ansible_dellemc.openmanage.idrac_system_info_payload_1qk0etkl/ansible_dellemc.openmanage.idrac_system_info_payload.zip/ansible_collections/dellemc/openmanage/plugins/module_utils/dellemc_idrac.py", line 86, in __enter__
  File "/usr/local/lib/python3.11/site-packages/omsdk/sdkinfra.py", line 88, in importPath
    module_loaded = self.load_from_file(fl[i])
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/omsdk/sdkinfra.py", line 61, in load_from_file
    py_mod = load_module(mod_name, filepath, False)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/omsdk/sdkinfra.py", line 43, in load_module
    loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/local/lib/python3.11/site-packages/omdrivers/iDRAC.py", line 1915, in <module>
    'SysObjectID' : ObjectIdentity('SNMPv2-MIB', 'sysObjectID'),
                    ^^^^^^^^^^^^^^
NameError: name 'ObjectIdentity' is not defined
aaron-goulet-servicenow commented 1 month ago

I've been able to confirm this issue as well. I have added an explicit pysnmp==6.1.3 directive to my project's requirements.txt as a workaround, but a permanent fix would be greatly appreciated!

aaron-goulet-servicenow commented 1 month ago

I'd also posit that the urgency of this problem is high, as this will affect anyone that is attempting to use the dellemc.openmanage Ansible collection, which ships as part of the main ansible package, out-of-the-box.

anupamaloke commented 1 month ago

@MallocArray, @aaron-goulet-servicenow, we are on it and will keep you updated on the release with the fix. Meanwhile, please continue to use the workaround as suggested by @aaron-goulet-servicenow. Thank you for your patience.

vdudejon commented 1 month ago

I found that updating omdrivers/iDRAC.py with from pysnmp.smi.rfc1902 import ObjectIdentity fixed the issue