Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azure.azcollection.azure_rm_snapshot snapshot creation fails #1478

Closed
Alffernandez opened this issue Mar 5, 2024 · 2 comments · Fixed by #1554
Closed

azure.azcollection.azure_rm_snapshot snapshot creation fails #1478

Alffernandez opened this issue Mar 5, 2024 · 2 comments · Fixed by #1554
Labels
bug Something isn't working has_pr PR fixes have been made medium_priority Medium priority question Further information is requested

Comments

@Alffernandez
Copy link

SUMMARY

azure_rm_snapshot fails with the following error:

module_stderr: |- Traceback (most recent call last): File "/tmp/.ansible_/tmp/ansible-tmp-1709387186.9568183-626-95902907116320/AnsiballZ_azure_rm_snapshot.py", line 107, in <module> _ansiballz_main() File "/tmp/.ansible_/tmp/ansible-tmp-1709387186.9568183-626-95902907116320/AnsiballZ_azure_rm_snapshot.py", line 99, in _ansiballz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) File "/tmp/.ansible_/tmp/ansible-tmp-1709387186.9568183-626-95902907116320/AnsiballZ_azure_rm_snapshot.py", line 47, in invoke_module runpy.run_module(mod_name='ansible_collections.azure.azcollection.plugins.modules.azure_rm_snapshot', init_globals=dict(_module_fqn='ansible_collections.azure.azcollection.plugins.modules.azure_rm_snapshot', _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_azure_rm_snapshot_payload_16oxyv7q/ansible_azure_rm_snapshot_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_snapshot.py", line 398, in <module> File "/tmp/ansible_azure_rm_snapshot_payload_16oxyv7q/ansible_azure_rm_snapshot_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_snapshot.py", line 394, in main File "/tmp/ansible_azure_rm_snapshot_payload_16oxyv7q/ansible_azure_rm_snapshot_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_snapshot.py", line 217, in __init__ File "/tmp/ansible_azure_rm_snapshot_payload_16oxyv7q/ansible_azure_rm_snapshot_payload.zip/ansible_collections/azure/azcollection/plugins/module_utils/azure_rm_common.py", line 469, in __init__ File "/tmp/ansible_azure_rm_snapshot_payload_16oxyv7q/ansible_azure_rm_snapshot_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_snapshot.py", line 242, in exec_module File "/tmp/ansible_azure_rm_snapshot_payload_16oxyv7q/ansible_azure_rm_snapshot_payload.zip/ansible_collections/azure/azcollection/plugins/module_utils/azure_rm_common.py", line 948, in get_mgmt_svc_client AttributeError: 'GenericRestClient' object has no attribute '_config'. Did you mean: 'config'?
ISSUE TYPE
  • Bug Report
ANSIBLE VERSION
ansible-playbook [core 2.15.9] 
COLLECTION VERSION
azure.azcollection 2.2.0
CONFIGURATION

OS / ENVIRONMENT
NAME="Red Hat Enterprise Linux"
VERSION="8.8 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.8 (Ootpa)"
STEPS TO REPRODUCE
1. Create an execution environment with azure.azcollection 2.2.0 and all its dependencies. Or install azure.azcollection 2.2.0 and all its dependencies directly.

2. Run the following playbook:

  name: Azure snapshot
  hosts: all
  tasks:
   - name: Create a snapshot by copying an existing managed disk.
     azure_rm_snapshot:
       resource_group: "{{ vm_details.resource_group|lower }}"
       subscription_id: "{{ vm_details.subscription_id }}"
       tenant: "{{ azuzones[vm_details.subscription_id].tenant}}"
       secret: "{{ azuzones[vm_details.subscription_id].secret}}"
       client_id:  "{{ azuzones[vm_details.subscription_id].client_id}}"
       name: mySnapshot
       cert_validation_mode: ignore
       sku:
         name: Standard_ZRS
       creation_data:
         create_option: Copy
         source_id: "{{ item }}"
       append_tags: True
       tags:
         test: "test"

3. Get the following error:

AttributeError: 'GenericRestClient' object has no attribute '_config'. Did you mean: 'config'?

This error is not happening with much older azure.azcollection versions.

Also, a similar error was reported in the following Github ticket:

#827

After adding the certificates and removed the option to ignore certs and the error has been fixed so, the error looks appearing when the certificates are ignored.

EXPECTED RESULTS
Able to perform snapshots with the latest azure.azcollection version.
ACTUAL RESULTS
Unable to perform snapshots with the latest azure.azcollection version.
@Fred-sun
Copy link
Collaborator

Fred-sun commented Mar 6, 2024

@Alffernandez I'm very sorry that after upgrading to the SDK of track2, I haven't found a way to replace clinet._config. I'm still looking for a way to solve this problem. Please do not add parameter 'cert_validation_mode' to playbook until the problem is solved. Thank you!

@Fred-sun Fred-sun added bug Something isn't working medium_priority Medium priority work in In trying to solve, or in working with contributors question Further information is requested labels Mar 6, 2024
@Fred-sun Fred-sun added has_pr PR fixes have been made and removed work in In trying to solve, or in working with contributors labels May 10, 2024
@Fred-sun
Copy link
Collaborator

@Alffernandez Fixed by #1554, Please take a try! Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has_pr PR fixes have been made medium_priority Medium priority question Further information is requested
Projects
None yet
2 participants