Skip to content

Commit 3d309c3

Browse files
authored
Remove initializing tools status (#141)
* remove initialize tools status Signed-off-by: dianew <[email protected]>
1 parent 0661bd8 commit 3d309c3

File tree

17 files changed

+113
-91
lines changed

17 files changed

+113
-91
lines changed

common/vm_get_ip.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,18 @@
2020

2121
# Get VM IP address when VMware tools is installed
2222
- include_tasks: vm_get_ip_from_vmtools.yml
23-
when: vmtools_is_installed and vmtools_is_running
23+
when:
24+
- vmtools_is_running is defined
25+
- vmtools_is_running | bool
2426

2527
# Get VM IP address when VMware tools not installed or not get from VMware tools
2628
- include_tasks: vm_get_ip_from_notools.yml
2729
when: >
28-
(not vmtools_is_installed) or
29-
(not vmtools_is_running) or
30-
(vm_guest_ip is undefined or not vm_guest_ip)
30+
(vmtools_is_installed is undefined) or
31+
(not vmtools_is_installed | bool) or
32+
(vmtools_is_running is undefined) or
33+
(not vmtools_is_running | bool) or
34+
(not vm_guest_ip)
3135
3236
- name: "Check VM '{{ vm_name }}' IP address"
3337
assert:

common/vm_get_vmtools_status.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@
77
# vmtools_is_running: True or False. VMware Tools is running or not.
88
# vmtools_is_ovt: True or False. VMware Tools is open-vm-tools or not.
99
#
10-
- name: Initialize VMware Tools installed status
11-
set_fact:
12-
vmtools_is_installed: False
13-
vmtools_is_running: False
14-
vmtools_is_ovt: False
15-
vmtools_not_ready: True
16-
1710
- name: Get VMware Tools installed information first
1811
vmware_guest_tools_info:
1912
hostname: "{{ vsphere_host_name }}"
@@ -58,10 +51,12 @@
5851
- name: Set fact of VMware Tools running status
5952
set_fact:
6053
vmtools_is_running: "{{ get_vmtools_info_retry.vmtools_info.vm_tools_running_status == 'guestToolsRunning' }}"
61-
when: vmtools_is_installed and vmtools_not_ready
54+
when:
55+
- vmtools_is_installed | default(False)
56+
- vmtools_not_ready | default(True)
6257

6358
- debug:
6459
msg:
65-
- "VMware tools is installed in guest: {{ vmtools_is_installed }}"
66-
- "VMware tools is running in guest: {{ vmtools_is_running }}"
67-
- "VMware tools is installed as open-vm-tools: {{ vmtools_is_ovt }}"
60+
- "VMware tools is installed in guest: {{ vmtools_is_installed | default(False) }}"
61+
- "VMware tools is running in guest: {{ vmtools_is_running | default(False) }}"
62+
- "VMware tools is installed as open-vm-tools: {{ vmtools_is_ovt | default(False) }}"

linux/setup/test_setup.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@
3535
# Get VMware tools version info
3636
- include_tasks: ../utils/get_guest_ovt_version_build.yml
3737
when:
38+
- vmtools_is_installed is defined
3839
- vmtools_is_installed | bool
3940
- vmtools_info_from_vmtoolsd is undefined or not vmtools_info_from_vmtoolsd
4041

4142
# Get VM guest info guest id, guest full name and guest detailed data
4243
- include_tasks: ../../common/vm_get_guest_info.yml
4344
when:
44-
- vmtools_is_installed | bool
45+
- vmtools_is_running is defined
46+
- vmtools_is_running | bool
4547
- guestinfo_gathered is undefined or not guestinfo_gathered
4648

4749
# Create a base snapshot if it does not exist

windows/check_ip_address/check_ip_address.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
tasks:
1515
- block:
1616
- include_tasks: ../setup/test_setup.yml
17+
vars:
18+
skip_test_no_vmtools: True
1719
- block:
1820
- name: Get VM IP address from guest info
1921
include_tasks: ../../common/vm_get_ip_from_vmtools.yml
@@ -35,12 +37,9 @@
3537
loop: "{{ ethernet_ip_dict | dict2items }}"
3638
loop_control:
3739
loop_var: ip_list
38-
when: vmtools_is_installed and vmtools_is_running
39-
40-
- name: "Skip testcase: {{ ansible_play_name }}"
41-
debug:
42-
msg: "Skip test case '{{ ansible_play_name }}', VMware tools installed: {{ vmtools_is_installed }}, and running: {{ vmtools_is_running }}"
43-
when: not vmtools_is_installed or not vmtools_is_running
40+
when:
41+
- vmtools_is_running is defined
42+
- vmtools_is_running | bool
4443
rescue:
4544
- include_tasks: ../setup/rescue_cleanup.yml
4645
vars:

windows/check_os_fullname/check_os_fullname.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
tasks:
1515
- block:
1616
- include_tasks: ../setup/test_setup.yml
17+
vars:
18+
skip_test_no_vmtools: True
1719
- name: Set fact of the supported guest IDs in this test case
1820
set_fact:
1921
support_client_guest: ['windows9Guest', 'windows9_64Guest']
@@ -83,15 +85,9 @@
8385
fail_msg: "Guest fullname in guest info: {{ os_fullname_guestinfo }}, got from guest OS: {{ os_fullname_guest }}."
8486
success_msg: "Guest fullname in guest info: {{ os_fullname_guestinfo }} is the same as the one got from guest OS."
8587
ignore_errors: True
86-
when: vmtools_is_installed and vmtools_is_running
87-
88-
- name: "Skip testcase: {{ ansible_play_name }}"
89-
debug:
90-
msg: "Skip test case '{{ ansible_play_name }}', VMware tools installed: {{ vmtools_is_installed }}, running: {{ vmtools_is_running }}, guest ID: {{ vm_guest_id }}"
91-
when: >
92-
(not vmtools_is_installed) or
93-
(not vmtools_is_running) or
94-
(vm_guest_id not in support_client_guest and vm_guest_id not in support_server_guest)
88+
when:
89+
- vmtools_is_running is defined
90+
- vmtools_is_running | bool
9591
rescue:
9692
- include_tasks: ../setup/rescue_cleanup.yml
9793
vars:

windows/check_quiesce_snapshot/check_quiesce_snapshot.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
tasks:
1414
- block:
1515
- include_tasks: ../setup/test_setup.yml
16+
vars:
17+
skip_test_no_vmtools: True
1618
- block:
1719
- include_tasks: check_vmx_disk_enable_uuid.yml
1820
when: guest_os_product_type | lower == "server"
@@ -53,11 +55,9 @@
5355
- include_tasks: ../../common/vm_remove_snapshot.yml
5456
vars:
5557
snapshot_name: "{{ qs_snapshot_name }}"
56-
when: vmtools_is_installed and vmtools_is_running
57-
- name: "Skip testcase: {{ ansible_play_name }}"
58-
debug:
59-
msg: "Skip test case due to VMware tools installed: {{ vmtools_is_installed }}, running: {{ vmtools_is_running }}"
60-
when: not vmtools_is_installed or not vmtools_is_running
58+
when:
59+
- vmtools_is_running is defined
60+
- vmtools_is_running | bool
6161
rescue:
6262
- include_tasks: collect_vss_logs.yml
6363
when: collect_vss_logs is defined and collect_vss_logs

windows/guest_customization/gosc_sanity_dhcp.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
tasks:
1616
- block:
1717
- include_tasks: ../setup/test_setup.yml
18+
vars:
19+
skip_test_no_vmtools: True
1820
- block:
1921
- include_tasks: win_gosc_prepare.yml
2022
- name: Set fact of the network customize type to dhcp
@@ -86,12 +88,14 @@
8688
# Check timezone configured
8789
- include_tasks: check_timezone.yml
8890
when:
89-
- vmtools_is_installed and vmtools_is_running
90-
- vcenter_is_defined is defined and vcenter_is_defined
91+
- vmtools_is_running is defined
92+
- vmtools_is_running | bool
93+
- vcenter_is_defined is defined
94+
- vcenter_is_defined | bool
9195
- name: "Skip testcase: {{ ansible_play_name }}"
9296
debug:
93-
msg: "Skip test case '{{ ansible_play_name }}', VMware tools installed: {{ vmtools_is_installed }}, running: {{ vmtools_is_running }}, or vCenter configured: {{ vcenter_is_defined | default('NA') }}"
94-
when: not vmtools_is_installed or not vmtools_is_running or vcenter_is_defined is undefined
97+
msg: "Skip test case due to vCenter server is not configured"
98+
when: vcenter_is_defined is undefined
9599
rescue:
96100
- include_tasks: ../setup/rescue_cleanup.yml
97101
vars:

windows/guest_customization/gosc_sanity_staticip.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
tasks:
1616
- block:
1717
- include_tasks: ../setup/test_setup.yml
18+
vars:
19+
skip_test_no_vmtools: True
1820
- block:
1921
- include_tasks: win_gosc_prepare.yml
2022

@@ -78,12 +80,14 @@
7880
success_msg: "Check guest IP address, hostname after GOSC succeed."
7981
fail_msg: "Check guest IP address, hostname after GOSC failed."
8082
when:
81-
- vmtools_is_installed and vmtools_is_running
82-
- vcenter_is_defined is defined and vcenter_is_defined
83+
- vmtools_is_running is defined
84+
- vmtools_is_running | bool
85+
- vcenter_is_defined is defined
86+
- vcenter_is_defined | bool
8387
- name: "Skip testcase: {{ ansible_play_name }}"
8488
debug:
85-
msg: "Skip test case '{{ ansible_play_name }}', VMware tools installed: {{ vmtools_is_installed }}, running: {{ vmtools_is_running }}, or vCenter configured: {{ vcenter_is_defined | default('NA') }}"
86-
when: not vmtools_is_installed or not vmtools_is_running or vcenter_is_defined is undefined
89+
msg: "Skip test case due to vCenter server is not configured"
90+
when: vcenter_is_defined is undefined
8791
rescue:
8892
- include_tasks: ../setup/rescue_cleanup.yml
8993
vars:

windows/mouse_driver_vmtools/mouse_driver_vmtools.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
tasks:
1515
- block:
1616
- include_tasks: ../setup/test_setup.yml
17+
vars:
18+
skip_test_no_vmtools: True
1719
- block:
1820
# Get VMware pointing device driver version in Windows guest OS
1921
- include_tasks: ../utils/win_execute_cmd.yml
@@ -30,11 +32,9 @@
3032
- vmware_pointing_device_driver is regex("^\d+\.\d+\.\d+\.\d+$")
3133
fail_msg: "Get VMware pointing device driver failed."
3234
success_msg: "Get VMware pointing device driver succeed."
33-
when: vmtools_is_installed and vmtools_is_running
34-
- name: "Skip testcase: {{ ansible_play_name }}"
35-
debug:
36-
msg: "Skip test case due to VMware tools installed: {{ vmtools_is_installed }}, running: {{ vmtools_is_running }}"
37-
when: not vmtools_is_installed or not vmtools_is_running
35+
when:
36+
- vmtools_is_running is defined
37+
- vmtools_is_running | bool
3838
rescue:
3939
- include_tasks: ../setup/rescue_cleanup.yml
4040
vars:

windows/network_device_ops/vmxnet3_network_device_ops.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@
1717
nic_type: 'VMXNET3'
1818
- block:
1919
- include_tasks: ../setup/test_setup.yml
20-
- name: Add vmxnet3 network adapter to VM and verify status
21-
include_tasks: network_adapter_deviceops.yml
22-
when: vmtools_is_installed and vmtools_is_running
23-
24-
- name: "Skip testcase: {{ ansible_play_name }}"
25-
debug:
26-
msg: "Skip test case due to VMware tools installed: {{ vmtools_is_installed }}, and running: {{ vmtools_is_running }}"
27-
when: not vmtools_is_installed or not vmtools_is_running
20+
vars:
21+
skip_test_no_vmtools: True
22+
- include_tasks: network_adapter_deviceops.yml
23+
when:
24+
- vmtools_is_running is defined
25+
- vmtools_is_running | bool
2826
rescue:
2927
- include_tasks: ../setup/rescue_cleanup.yml
3028
vars:

0 commit comments

Comments
 (0)