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

+8-4
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

+6-11
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

+3-1
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

+5-6
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

+5-9
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

+5-5
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

+8-4
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

+8-4
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

+5-5
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

+6-8
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:

windows/setup/test_setup.yml

+13-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
- include_tasks: ../../common/vm_get_vmtools_status.yml
3131
- include_tasks: ../utils/win_get_vmtools_version_build.yml
3232
when:
33-
- vmtools_is_installed is defined and vmtools_is_installed
33+
- vmtools_is_installed is defined
34+
- vmtools_is_installed | bool
3435
- vmtools_info_from_vmtoolsd is undefined or not vmtools_info_from_vmtoolsd
3536

3637
# Get guest OS info if not defined
@@ -40,9 +41,19 @@
4041
# Get VM guest info guest id, guest full name and guest detailed data
4142
- include_tasks: ../../common/vm_get_guest_info.yml
4243
when:
43-
- vmtools_is_installed | bool
44+
- vmtools_is_running is defined
45+
- vmtools_is_running | bool
4446
- guestinfo_gathered is undefined or not guestinfo_gathered
4547

4648
# Take base snapshot if not exist
4749
- include_tasks: create_base_snapshot.yml
4850
when: not base_snapshot_exists
51+
52+
# Skip test case run when VMware tools is required but not installed or not running
53+
- name: "Skip testcase: {{ ansible_play_name }}"
54+
debug:
55+
msg: "Skip test case due to VMware tools installed: {{ vmtools_is_installed | default(False) }}, running: {{ vmtools_is_running | default(False) }}"
56+
when:
57+
- skip_test_no_vmtools is defined
58+
- skip_test_no_vmtools
59+
- not (vmtools_is_running is defined and vmtools_is_running | bool)

windows/stat_balloon/stat_balloon.yml

+5-5
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: ../utils/win_execute_cmd.yml
2022
vars:
@@ -26,11 +28,9 @@
2628
- win_powershell_cmd_output.stdout_lines[0] == '0 MB'
2729
fail_msg: "stat_balloon test failed"
2830
success_msg: "stat_balloon test passed"
29-
when: vmtools_is_installed and vmtools_is_running
30-
- name: "Skip testcase: {{ ansible_play_name }}"
31-
debug:
32-
msg: "Skip test case due to VMware tools installed: {{ vmtools_is_installed }}, running: {{ vmtools_is_running }}"
33-
when: not vmtools_is_installed or not vmtools_is_running
31+
when:
32+
- vmtools_is_running is defined
33+
- vmtools_is_running | bool
3434
rescue:
3535
- include_tasks: ../setup/rescue_cleanup.yml
3636
vars:

windows/utils/shutdown_vm.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@
1111
vars:
1212
vm_power_state_set: 'shutdown-guest'
1313
when:
14-
- vmtools_is_installed is defined and vmtools_is_installed
15-
- vmtools_is_running is defined and vmtools_is_running
14+
- vmtools_is_running is defined
15+
- vmtools_is_running | bool
1616

1717
- include_tasks: win_shutdown_restart.yml
1818
vars:
1919
set_win_power_state: 'shutdown'
20-
when:
21-
- vmtools_is_installed is undefined or not vmtools_is_installed
20+
when: >
21+
(vmtools_is_installed is undefined) or
22+
(not vmtools_is_installed | bool) or
23+
(vmtools_is_running is undefined) or
24+
(not vmtools_is_running | bool)

windows/vgauth_check_service/vgauth_check_service.yml

+5-5
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 VGAuthService status in Windows guest OS
1921
include_tasks: ../utils/win_get_service_status.yml
@@ -25,11 +27,9 @@
2527
- service_status == "Running"
2628
fail_msg: "VGAuth Service is not running in guest OS."
2729
success_msg: "VGAuth service is running in guest OS."
28-
when: vmtools_is_installed and vmtools_is_running
29-
- name: "Skip testcase: {{ ansible_play_name }}"
30-
debug:
31-
msg: "Skip test case due to VMware tools installed: {{ vmtools_is_installed }}, running: {{ vmtools_is_running }}"
32-
when: not vmtools_is_installed or not vmtools_is_running
30+
when:
31+
- vmtools_is_running is defined
32+
- vmtools_is_running | bool
3333
rescue:
3434
- include_tasks: ../setup/rescue_cleanup.yml
3535
vars:

windows/vhba_hot_add_remove/paravirtual_vhba_device_ops.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
tasks:
1515
- block:
1616
- include_tasks: ../setup/test_setup.yml
17+
vars:
18+
skip_test_no_vmtools: True
1719
- include_tasks: hotadd_remove_vhba_test.yml
1820
vars:
1921
test_disk_controller_type: "paravirtual"
20-
when: vmtools_is_installed and vmtools_is_running
21-
- name: "Skip testcase: {{ ansible_play_name }}"
22-
debug:
23-
msg: "Skip test case due to VMware tools installed: {{ vmtools_is_installed }}, running: {{ vmtools_is_running }}"
24-
when: not vmtools_is_installed or not vmtools_is_running
22+
when:
23+
- vmtools_is_running is defined
24+
- vmtools_is_running | bool
2525
rescue:
2626
- include_tasks: ../setup/rescue_cleanup.yml
2727
vars:

windows/wintools_complete_install_verify/wintools_complete_install_verify.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,16 @@
5353
- include_tasks: ../../linux/open_vm_tools/set_base_snapshot.yml
5454
- include_tasks: detach_vmtools_and_remove.yml
5555
when: >
56-
(vmtools_is_installed and update_vmtools) or
57-
(not vmtools_is_installed)
56+
(vmtools_is_installed is undefined) or
57+
(not vmtools_is_installed | bool) or
58+
(vmtools_is_installed | bool and update_vmtools | bool)
5859
- name: "Skip testcase: {{ ansible_play_name }}"
5960
debug:
6061
msg: "Skip test case due to VMware tools is installed, update VMware tools is set to: {{ update_vmtools }}"
61-
when: vmtools_is_installed and not update_vmtools
62+
when:
63+
- vmtools_is_installed is defined
64+
- vmtools_is_installed | bool
65+
- not update_vmtools | bool
6266
rescue:
6367
- include_tasks: ../setup/rescue_cleanup.yml
6468
vars:

0 commit comments

Comments
 (0)