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_guest - 'TypeError: 'NoneType' object is not iterable' #2205

Open
neevnuv opened this issue Oct 12, 2024 · 1 comment
Open

vmware_guest - 'TypeError: 'NoneType' object is not iterable' #2205

neevnuv opened this issue Oct 12, 2024 · 1 comment

Comments

@neevnuv
Copy link

neevnuv commented Oct 12, 2024

SUMMARY

When running vmware_guest to create a new vm, we receive the error:
TypeError: 'NoneType' object is not iterable in module_utiles/vmware.py line 1281.

This is cause because the actual_vm_folder_path variable is None. Which means the function get_vm_path returns None.
Going through the function we have concluded that vm_name.parent has returned None (we haven't yet found why).

As a short fix, my team changed these line with vm_obj = vms[0].

We work in an airgapped environment so it is more difficult to add logs, we hoped by opening this issue that an handler will be added for when the actual_vm_folder_path variable is empty.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • vmware_guest
  • state: poweredon
  • Creating Virtual Machine
ANSIBLE VERSION
ansible-core 2.14
COLLECTION VERSION
latest (5.0.1), this issue happens in all previous versions
CONFIGURATION
Will be added in the future
OS / ENVIRONMENT

VSphere 8.0.3
RHEL 8/7 VM

STEPS TO REPRODUCE
- name: Create a virtual machine from a template
  community.vmware.vmware_guest:
    hostname: "{{ vcenter_hostname }}"
    username: "{{ vcenter_username }}"
    password: "{{ vcenter_password }}"
    folder: "{{ vcenter_folder }}"
    name: my-vm
    state: poweredon
    template: rhel8
    disk:
    - size_gb: 10
      type: thin
      datastore: "{{ vcenter_datastore }}"
    hardware:
      memory_mb: 512
      num_cpus: 4
    networks:
    - name: VM Network
      ip: {{ vcenter_ip }}
      netmask: 255.255.255.0
    wait_for_ip_address: true
  delegate_to: localhost
  register: dployed_vm
EXPECTED RESULTS

A new vm was created in the folder specified

ACTUAL RESULTS
TypeError: 'NoneType' object is not iterable
@mariolenz
Copy link
Collaborator

Just FYI version 5.0.1 of this collection doesn't support ansible-core 2.14. But I don't think this is the problem here.

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

2 participants