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

vmware_all_snapshots_info: AttributeError: 'NoneType' object has no attribute 'name' #2268

Open
StratsScorpio opened this issue Dec 5, 2024 · 0 comments

Comments

@StratsScorpio
Copy link

SUMMARY
  • On Execution I get the error "AttributeError: 'NoneType' object has no attribute 'name'"
ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • community.vmware.vmware_all_snapshots_info
ANSIBLE VERSION
ansible-playbook [core 2.18.1]
  python version = 3.12.3 (main, Nov  6 2024, 18:32:19) [GCC 13.2.0] (/usr/bin/python3)
  jinja version = 3.1.4
  libyaml = True
COLLECTION VERSION
Collection        Version
----------------- -------
ansible.posix     1.5.4  
ansible.utils     5.1.0  
checkmk.general   5.2.1  
community.general 9.3.0  
community.vmware  5.2.0  
vmware.vmware     1.7.1
CONFIGURATION
ANSIBLE_PIPELINING(/home/ansible/server/ansible.cfg) = True
CACHE_PLUGIN(/home/ansible/server/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/home/ansible/server/ansible.cfg) = ./.ansible-cache
CACHE_PLUGIN_TIMEOUT(/home/ansible/server/ansible.cfg) = 86400
COLLECTIONS_PATHS(/home/ansible/server/ansible.cfg) = ['/home/ansible/server/collections']
CONFIG_FILE() = /home/ansible/server/ansible.cfg
DEFAULT_CALLBACK_PLUGIN_PATH(/home/ansible/server/ansible.cfg) = ['/home/ansible/server/callbacks']
DEFAULT_FORKS(/home/ansible/server/ansible.cfg) = 20
DEFAULT_HOST_LIST(/home/ansible/server/ansible.cfg) = ['/home/ansible/server/inventory']
DEFAULT_REMOTE_USER(/home/ansible/server/ansible.cfg) = root
DEFAULT_ROLES_PATH(/home/ansible/server/ansible.cfg) = ['/home/ansible/server/roles']
DEFAULT_STDOUT_CALLBACK(/home/ansible/server/ansible.cfg) = yaml
DISPLAY_SKIPPED_HOSTS(env: ANSIBLE_DISPLAY_SKIPPED_HOSTS) = False
HOST_KEY_CHECKING(/home/ansible/server/ansible.cfg) = False
MAX_FILE_SIZE_FOR_DIFF(/home/ansible/server/ansible.cfg) = 1044480
OS / ENVIRONMENT
  • Debian 12
  • Mint Linux 22
STEPS TO REPRODUCE

Execute the adhoc-script which calls the role vm_snapshots. The gathering yml is main.yml in tasks from this role.
Variables are defined in defaults/main.yml from this role.

---
- name: Clear all VM Snapshots
  hosts: localhost
  roles:
    - role: vm_snapshots
...

roles/vm_snapshots/tasks/main.yml:

---
- name: Gather information of specified snapshots
  community.vmware.vmware_all_snapshots_info:
    validate_certs: false
    hostname: '{{ vmdeploy_vcenter_hostname }}'
    username: '{{ vmdeploy_vcenter_user }}'
    password: '{{ vmdeploy_vcenter_password }}'
    datacenter: '{{ vmdeploy_datacenter }}'
    match_type: 'includes'
    filters:
      name: '{{ vm_snapshots_snapshot_name }}'
  delegate_to: localhost
...
EXPECTED RESULTS

A return like in the ansible-documentation

ACTUAL RESULTS

Unexpected Error.

TASK [vm_snapshots : Gather information of specified snapshots] ********************************************************************
task path: /home/ansible/server/roles/vm_snapshots/tasks/main.yml:6
The full traceback is:
Traceback (most recent call last):
  File "<stdin>", line 107, in <module>
  File "<stdin>", line 99, in _ansiballz_main
  File "<stdin>", line 47, in invoke_module
  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_community.vmware.vmware_all_snapshots_info_payload_rm50o0_l/ansible_community.vmware.vmware_all_snapshots_info_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_all_snapshots_info.py", line 204, in <module>
  File "/tmp/ansible_community.vmware.vmware_all_snapshots_info_payload_rm50o0_l/ansible_community.vmware.vmware_all_snapshots_info_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_all_snapshots_info.py", line 199, in main
  File "/tmp/ansible_community.vmware.vmware_all_snapshots_info_payload_rm50o0_l/ansible_community.vmware.vmware_all_snapshots_info_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_all_snapshots_info.py", line 164, in gather_snapshots_info
AttributeError: 'NoneType' object has no attribute 'name'
fatal: [localhost]: FAILED! => changed=false 
  module_stderr: |-
    Traceback (most recent call last):
      File "<stdin>", line 107, in <module>
      File "<stdin>", line 99, in _ansiballz_main
      File "<stdin>", line 47, in invoke_module
      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_community.vmware.vmware_all_snapshots_info_payload_rm50o0_l/ansible_community.vmware.vmware_all_snapshots_info_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_all_snapshots_info.py", line 204, in <module>
      File "/tmp/ansible_community.vmware.vmware_all_snapshots_info_payload_rm50o0_l/ansible_community.vmware.vmware_all_snapshots_info_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_all_snapshots_info.py", line 199, in main
      File "/tmp/ansible_community.vmware.vmware_all_snapshots_info_payload_rm50o0_l/ansible_community.vmware.vmware_all_snapshots_info_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_all_snapshots_info.py", line 164, in gather_snapshots_info
    AttributeError: 'NoneType' object has no attribute 'name'
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1

PLAY RECAP *************************************************************************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant