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

opentelekomcloud.cloud.cbr_vault fails at second Run #226

Open hadoopch opened 2 years ago

hadoopch commented 2 years ago

Hi all,

today i tried opentelekomcloud.cloud.cbr_vault. I wanted to create a server backup vault. When i run the playbook the first time everything is working fine. In the second run i ge the the follwoing error:

The full traceback is:
  File "/tmp/ansible_opentelekomcloud.cloud.cbr_vault_payload_8y8whj25/ansible_opentelekomcloud.cloud.cbr_vault_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/module_utils/otc.py", line 201, in __call__
    results = self.run()
  File "/tmp/ansible_opentelekomcloud.cloud.cbr_vault_payload_8y8whj25/ansible_opentelekomcloud.cloud.cbr_vault_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/modules/cbr_vault.py", line 517, in run
  File "/home/linux/ansible-env/lib/python3.8/site-packages/otcextensions/sdk/cbr/v3/_proxy.py", line 313, in update_vault
    return self._update(_vault.Vault, vault, **attrs)
  File "/home/linux/ansible-env/lib/python3.8/site-packages/openstack/proxy.py", line 48, in check
    return method(self, expected, actual, *args, **kwargs)
  File "/home/linux/ansible-env/lib/python3.8/site-packages/openstack/proxy.py", line 439, in _update
    return res.commit(self, base_path=base_path)
  File "/home/linux/ansible-env/lib/python3.8/site-packages/openstack/resource.py", line 1562, in commit
    return self._commit(session, request, self.commit_method, microversion,
  File "/home/linux/ansible-env/lib/python3.8/site-packages/openstack/resource.py", line 1590, in _commit
    self._translate_response(response, has_body=has_body)
  File "/home/linux/ansible-env/lib/python3.8/site-packages/openstack/resource.py", line 1177, in _translate_response
    exceptions.raise_from_response(response, error_message=error_message)
  File "/home/linux/ansible-env/lib/python3.8/site-packages/otcextensions/common/exc.py", line 286, in raise_from_response
    raise cls(
fatal: [localhost]: FAILED! => {
    "changed": false,
    "extra_data": {
        "data": null,
        "details": "BackupService.9900",
        "response": "{\"error_code\": \"BackupService.9900\", \"error_msg\": \"Invalid input for field/attribute billing. Value: {'consistent_level': 'crash_consistent', 'object_type': 'server', 'protect_type': 'backup', 'size': 200, 'charging_mode': 'post_paid'}. Additional properties are not allowed ('charging_mode', 'object_type', 'protect_type' were unexpected)\"}"
    },
  tasks:
        - name: Create vault
          opentelekomcloud.cloud.cbr_vault:
            name: "vault-gateway-server"
            resources:
              - id: '42604a31-d6dc-450b-9a06-3e4781da1ad8'
                type: "OS::Nova::Server"
              - id: '8d4d223a-1983-4f16-b13e-66726d6d036d'
                type: "OS::Nova::Server"
            billing:
              consistent_level: "crash_consistent"
              object_type: "server"
              protect_type: "backup"
              size: 200

Could you please check ?

Thanks in advance

Uli

Polina-Gubina commented 1 year ago

hi! now it is fixed

hadoopch commented 1 year ago

Hi Polina,

it is fixed for state present. But for the state absent it has still problems in the second run. I get the following error.

The full traceback is:
Traceback (most recent call last):
  File "/home/linux/.ansible/tmp/ansible-tmp-1680773288.3978603-2246-59218644342428/AnsiballZ_cbr_vault.py", line 107, in <module>
    _ansiballz_main()
  File "/home/linux/.ansible/tmp/ansible-tmp-1680773288.3978603-2246-59218644342428/AnsiballZ_cbr_vault.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/linux/.ansible/tmp/ansible-tmp-1680773288.3978603-2246-59218644342428/AnsiballZ_cbr_vault.py", line 47, in invoke_module
    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),
  File "/usr/local/lib/python3.8/runpy.py", line 206, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/local/lib/python3.8/runpy.py", line 96, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/local/lib/python3.8/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_opentelekomcloud.cloud.cbr_vault_payload_j7_cnl3n/ansible_opentelekomcloud.cloud.cbr_vault_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/modules/cbr_vault.py", line 598, in <module>
  File "/tmp/ansible_opentelekomcloud.cloud.cbr_vault_payload_j7_cnl3n/ansible_opentelekomcloud.cloud.cbr_vault_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/modules/cbr_vault.py", line 594, in main
  File "/tmp/ansible_opentelekomcloud.cloud.cbr_vault_payload_j7_cnl3n/ansible_opentelekomcloud.cloud.cbr_vault_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/module_utils/otc.py", line 215, in __call__
  File "/tmp/ansible_opentelekomcloud.cloud.cbr_vault_payload_j7_cnl3n/ansible_opentelekomcloud.cloud.cbr_vault_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/modules/cbr_vault.py", line 565, in run
AttributeError: 'NoneType' object has no attribute 'id'
fatal: [localhost]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/home/linux/.ansible/tmp/ansible-tmp-1680773288.3978603-2246-59218644342428/AnsiballZ_cbr_vault.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/home/linux/.ansible/tmp/ansible-tmp-1680773288.3978603-2246-59218644342428/AnsiballZ_cbr_vault.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/linux/.ansible/tmp/ansible-tmp-1680773288.3978603-2246-59218644342428/AnsiballZ_cbr_vault.py\", line 47, 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/local/lib/python3.8/runpy.py\", line 206, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/local/lib/python3.8/runpy.py\", line 96, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/local/lib/python3.8/runpy.py\", line 86, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_opentelekomcloud.cloud.cbr_vault_payload_j7_cnl3n/ansible_opentelekomcloud.cloud.cbr_vault_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/modules/cbr_vault.py\", line 598, in <module>\n  File \"/tmp/ansible_opentelekomcloud.cloud.cbr_vault_payload_j7_cnl3n/ansible_opentelekomcloud.cloud.cbr_vault_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/modules/cbr_vault.py\", line 594, in main\n  File \"/tmp/ansible_opentelekomcloud.cloud.cbr_vault_payload_j7_cnl3n/ansible_opentelekomcloud.cloud.cbr_vault_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/module_utils/otc.py\", line 215, in __call__\n  File \"/tmp/ansible_opentelekomcloud.cloud.cbr_vault_payload_j7_cnl3n/ansible_opentelekomcloud.cloud.cbr_vault_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/modules/cbr_vault.py\", line 565, in run\nAttributeError: 'NoneType' object has no attribute 'id'\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

Could you please check ?

Thanks in advance

Uli