ovirt-ansible-collection icon indicating copy to clipboard operation
ovirt-ansible-collection copied to clipboard

module 'inspect' has no attribute 'getargspec' after upgrading to Fedora 37

Open tinsjourney opened this issue 1 year ago • 5 comments

SUMMARY

After upgrading to Fedora37, module ovirt_network et ovirt_host_network failed with error : module 'inspect' has no attribute 'getargspec'

COMPONENT NAME

ovirt_host_network ovirt_network

but maybe other one

STEPS TO REPRODUCE
      - name: Create Openstack network
        ovirt_network:
          auth: "{{ ovirt_auth }}"
          data_center: "Default"
          clusters:
            - name: Default
              assigned: true
          name: "{{ item.name }}"
          vlan_tag: "{{ item.vlan }}"
          vm_network: true
        loop:
          - { name: "osp-provisionning-s0", vlan: 1 }

      - name: Add Openstack Network to Host
        ovirt_host_network:
          auth: "{{ ovirt_auth }}"
          name: rhvh.redhat.lab
          interface: enp1s0
          networks:
            - name: osp-provisionning-s0

EXPECTED RESULTS

logical network create and network host configured

ACTUAL RESULTS

TASK [Create Openstack network] ******************************************************************************************************************************************************************************************************************************************************************************************************************************************** Thursday 24 November 2022 17:16:59 +0100 (0:00:00.620) 0:00:03.714 ***** An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: module 'inspect' has no attribute 'getargspec' failed: [localhost] (item={'name': 'osp-provisionning-s0', 'vlan': 1}) => {"ansible_loop_var": "item", "changed": false, "item": {"name": "osp-provisionning-s0", "vlan": 1}, "msg": "module 'inspect' has no attribute 'getargspec'"}

tinsjourney avatar Nov 24 '22 16:11 tinsjourney

Hi, what are your versions?

  • Python
  • ansible / ansible-core
  • Ovirt collection
  • Ovirt sdk python
  • Ovirt engine

Also I think vlan: 1 is interpreted as a boolean. Try quoting it or forcing its type to an integer.

Gounick avatar Nov 24 '22 23:11 Gounick

Hi,

Python 3.11.0 ansible-core: 2.13.5 ansible: 6.5.0 Ovirt Collection: 2.4.0 Ovirt sdk python : 4.5.2 Ovirt engine: 4.4.9.5

Ovirt-engine is the Red Hat version not the upstream one. I tried quoting the vlan number, but stiil same issue

tinsjourney avatar Nov 25 '22 13:11 tinsjourney

Try to downgrade to Python 3.9, that's the supported python version for ansible-core-2.13

mwperina avatar Nov 25 '22 13:11 mwperina

I confirm it's working with python 3.9 and python 3.10, but not with the default python version shipped with fedora 37. I also updated ansible-core to 2.14, ansible to 7.0.0 and same behavior regarding the version.

where can I find the matching between ansible-core and python, so I can open a BZ to Fedora ?

I also noticed getargspecs function is supposed to be deprecated in python, so I think the issue is still legit and will happen when python3.11 will be supported with ansible-core

tinsjourney avatar Nov 28 '22 09:11 tinsjourney

Personally i will see:

  • Changelog
    • https://github.com/ansible/ansible/blob/v2.13.0/changelogs/CHANGELOG-v2.13.rst
    • https://github.com/ansible/ansible/blob/stable-2.14/changelogs/CHANGELOG-v2.14.rst
  • Pypi - Programming Language list
    • https://pypi.org/project/ansible-core/2.13.6/
    • https://pypi.org/project/ansible-core/2.14.0/
  • Python versions used in Pipeline
    • https://github.com/ansible/ansible/blob/v2.13.6/.azure-pipelines/azure-pipelines.yml
    • https://github.com/ansible/ansible/blob/v2.14.0/.azure-pipelines/azure-pipelines.yml

I recommend you to use a Python version manager like Pyenv for example, associated with Pipenv to become independent of your distribution's packages and avoid this inconvenience.

Gounick avatar Nov 28 '22 17:11 Gounick