Skip to content

Commit

Permalink
vmware_guest_network: fix the network look up
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
goneri committed Jul 25, 2019
1 parent 585128e commit ef59dd2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/ansible/module_utils/vmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ def find_network_by_name(self, network_name=None):
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
Expand Down
10 changes: 5 additions & 5 deletions test/integration/targets/vmware_guest_network/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit ef59dd2

Please sign in to comment.