opentelekomcloud / ansible-collection-cloud

Ansible modules for using with OTC (addition to the native OpenStack modules)
Apache License 2.0
21 stars 14 forks source link

CBR ModuleNotFoundError #243

Open generalpax opened 1 year ago

generalpax commented 1 year ago

Want to associate server to backup vault but get error "An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'openstack.common'"

    - name: "Associate server with backup vault"
      opentelekomcloud.cloud.cbr_vault:
        auth: "{{ auth }}"
        name: "{{ cbr_backup_vault_name }}"
        billing:
          object_type: server
          protect_type: backup
          size: "{{ cbr_backup_vault_size }}"
        action: "associate_resources"
        resources: 
          - type: 'OS::Nova::Server'
            name: uvairz5168
            id: bce3f737-b121-4f4b-a6b2-6168f5a906e0

requirements.yaml

collections:
  - name: https://github.com/opentelekomcloud/ansible-collection-cloud.git
    type: git
    version: 0.13.0

requirements.txt

ansible==4.10.0
ansible-core==2.11.12
ansible-lint
jmespath
wheel
zeep~=4.1.0
PySocks==1.7.1
dnspython==2.2.1
psutil==5.9.4
otcextensions==0.28.2
openstacksdk==0.59
lxml==4.9.1

got error:

(venv) [linux@tos-jump-linux tos]$ ansible-playbook --ask-vault-password cbr_associate.yml -e project_name=tos-mgmt
Vault password: 
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
[WARNING]: Couldn't list Openstack hosts. See logs for details
The username or password is wrong. (HTTP 401)
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [launch a compute instance] ********************************************************************************************************************************************************************************************************************************************************

TASK [Group hosts by project name] ******************************************************************************************************************************************************************************************************************************************************
changed: [localhost]

TASK [Associate server with backup vault] ***********************************************************************************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'openstack.common'
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible-tmp-1670518734.5814748-767810-45487821804488/AnsiballZ_cbr_vault.py\", line 100, in <module>\n    _ansiballz_main()\n  File \"/tmp/ansible-tmp-1670518734.5814748-767810-45487821804488/AnsiballZ_cbr_vault.py\", line 92, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/tmp/ansible-tmp-1670518734.5814748-767810-45487821804488/AnsiballZ_cbr_vault.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.opentelekomcloud.cloud.plugins.modules.cbr_vault', init_globals=dict(_module_fqn='ansible_collections.opentelekomcloud.cloud.plugins.modules.cbr_vault', _modlib_path=modlib_path),\n  File \"/usr/lib64/python3.9/runpy.py\", line 225, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_opentelekomcloud.cloud.cbr_vault_payload_lrw31ih0/ansible_opentelekomcloud.cloud.cbr_vault_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/modules/cbr_vault.py\", line 575, in <module>\n  File \"/tmp/ansible_opentelekomcloud.cloud.cbr_vault_payload_lrw31ih0/ansible_opentelekomcloud.cloud.cbr_vault_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/modules/cbr_vault.py\", line 570, in main\n  File \"/tmp/ansible_opentelekomcloud.cloud.cbr_vault_payload_lrw31ih0/ansible_opentelekomcloud.cloud.cbr_vault_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/module_utils/otc.py\", line 100, in __init__\n  File \"/tmp/ansible_opentelekomcloud.cloud.cbr_vault_payload_lrw31ih0/ansible_opentelekomcloud.cloud.cbr_vault_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/module_utils/otc.py\", line 180, in openstack_cloud_from_module\n  File \"/home/linux/git/tos/venv/lib64/python3.9/site-packages/otcextensions/sdk/__init__.py\", line 357, in load\n    register_single_service(conn, service_name, project_id, service)\n  File \"/home/linux/git/tos/venv/lib64/python3.9/site-packages/otcextensions/sdk/__init__.py\", line 309, in register_single_service\n    sd = _get_descriptor(service_name)\n  File \"/home/linux/git/tos/venv/lib64/python3.9/site-packages/otcextensions/sdk/__init__.py\", line 189, in _get_descriptor\n    desc_class = _find_service_description_class(service_type)\n  File \"/home/linux/git/tos/venv/lib64/python3.9/site-packages/otcextensions/sdk/__init__.py\", line 234, in _find_service_description_class\n    service_description_module = importlib.import_module(import_name)\n  File \"/usr/lib64/python3.9/importlib/__init__.py\", line 127, in import_module\n    return _bootstrap._gcd_import(name[level:], package, level)\n  File \"<frozen importlib._bootstrap>\", line 1030, in _gcd_import\n  File \"<frozen importlib._bootstrap>\", line 1007, in _find_and_load\n  File \"<frozen importlib._bootstrap>\", line 986, in _find_and_load_unlocked\n  File \"<frozen importlib._bootstrap>\", line 680, in _load_unlocked\n  File \"<frozen importlib._bootstrap_external>\", line 850, in exec_module\n  File \"<frozen importlib._bootstrap>\", line 228, in _call_with_frames_removed\n  File \"/home/linux/git/tos/venv/lib64/python3.9/site-packages/otcextensions/sdk/elb/elb_service.py\", line 13, in <module>\n    from otcextensions.sdk.elb.v2 import _proxy as _proxy_v2\n  File \"/home/linux/git/tos/venv/lib64/python3.9/site-packages/otcextensions/sdk/elb/v2/_proxy.py\", line 16, in <module>\n    from otcextensions.sdk.elb.v2 import load_balancer as _load_balancer\n  File \"/home/linux/git/tos/venv/lib64/python3.9/site-packages/otcextensions/sdk/elb/v2/load_balancer.py\", line 14, in <module>\n    from openstack.common import tag\nModuleNotFoundError: No module named 'openstack.common'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
        to retry, use: --limit @/home/linux/git/tos/.ansible-retry/cbr_associate.retry

PLAY RECAP ******************************************************************************************************************************************************************************************************************************************************************************
localhost                  : ok=1    changed=1    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
gtema commented 1 year ago

This happens because of having old openstacksdk package. we now depend on openstacksdk>=0.99.0 This, however brings a challenge of needing to install OpenStack collection from git repository directly and not through galaxy. This is going to be fixed hopefully next week (a really huge amount of work involved)