vmware_guest_network: fix the network look up

Before this fix, the module was not able to look up a `VM Network` located at
`/DC0/network/VM Network`. As a consequence, the test module was failing
with a real environment (Non-govcsim).
pull/59586/head^2
Gonéri Le Bouder 5 years ago
parent 585128e5ac
commit ef59dd2ca2

@ -1195,7 +1195,7 @@ class PyVmomi(object):
if len(temp_vm_object.propSet) != 1:
continue
for temp_vm_object_property in temp_vm_object.propSet:
if temp_vm_object_property.val == self.params['name']:
if temp_vm_object_property.val == network_name:
networks.append(temp_vm_object.obj)
break
return networks

@ -17,7 +17,7 @@
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
name: "{{ infra.vm_list[0] }}"
name: "{{ virtual_machines[0].name }}"
gather_network_facts: true
register: netadapter_facts
@ -33,7 +33,7 @@
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
name: "{{ infra.vm_list[0] }}"
name: "{{ virtual_machines[0].name }}"
networks:
- name: "VM Network"
state: new
@ -59,7 +59,7 @@
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
name: "{{ infra.vm_list[0] }}"
name: "{{ virtual_machines[0].name }}"
networks:
- state: absent
mac: "00:50:56:58:59:60"
@ -79,7 +79,7 @@
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
name: "{{ infra.vm_list[0] }}"
name: "{{ virtual_machines[0].name }}"
networks:
- state: present
mac: "00:50:56:58:59:61"
@ -100,7 +100,7 @@
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
name: "{{ infra.vm_list[0] }}"
name: "{{ virtual_machines[0].name }}"
networks:
- name: non-existing-nw
manual_mac: "00:50:56:11:22:33"

Loading…
Cancel
Save