From b1d5d66c547eab27a5d8d3cb88c0da1221481c62 Mon Sep 17 00:00:00 2001 From: Yanan Shen Date: Thu, 13 Apr 2023 11:38:39 +0800 Subject: [PATCH] address comments Signed-off-by: Yanan Shen --- windows/mdag_enable_disable/enable_mdag.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/windows/mdag_enable_disable/enable_mdag.yml b/windows/mdag_enable_disable/enable_mdag.yml index 2ed93740b..a3baab9f2 100644 --- a/windows/mdag_enable_disable/enable_mdag.yml +++ b/windows/mdag_enable_disable/enable_mdag.yml @@ -94,6 +94,10 @@ mdag_process: "vmmemMDAG" virtual_process: "vmcompute" +- name: "Initialize the status of MDAG process" + ansible.builtin.set_fact: + mdag_process_running: false + - name: "Get virtual process {{ virtual_process }} before restart" include_tasks: ../utils/win_execute_cmd.yml vars: @@ -107,7 +111,8 @@ - name: "Set the result of getting MDAG process" ansible.builtin.set_fact: - mdag_process_result: "{{ win_powershell_cmd_output }}" + mdag_process_running: "{{ true if win_powershell_cmd_output.rc == 0 else false }}" + when: win_powershell_cmd_output.rc is defined - name: "Check MDAG process {{ mdag_process }} after restart" block: @@ -121,7 +126,15 @@ vars: win_powershell_cmd: "Get-Process -Name {{ mdag_process }}" win_execute_cmd_ignore_error: true + + - name: "Set the result of getting MDAG process" + ansible.builtin.set_fact: + mdag_process_running: "{{ true if win_powershell_cmd_output.rc == 0 else false }}" + when: win_powershell_cmd_output.rc is defined when: - guest_os_build_num | int > 22000 - - mdag_process_result.rc is defined - - mdag_process_result.rc != 0 \ No newline at end of file + - not mdag_process_running + +- name: "Display status of the MDAG process {{ mdag_process }}" + ansible.builtin.debug: + msg: "MDAG process {{ mdag_process }} running status: {{ mdag_process_running }}"