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: if len(temp_vm_object.propSet) != 1:
continue continue
for temp_vm_object_property in temp_vm_object.propSet: 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) networks.append(temp_vm_object.obj)
break break
return networks return networks

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

Loading…
Cancel
Save