From 788190beca37b6ec26185314b0bc265862254b89 Mon Sep 17 00:00:00 2001
From: somewho <somewho@gmail.com>
Date: Tue, 18 Jul 2023 15:45:10 +0300
Subject: [PATCH] reset_confirmation in reset.yml (#10288)

* Update reset.yml

reset confirmation user input fix

* Update reset.yml

added default for non-interactive run in ci/cd

* fix reset_confirmation in reset.yml

* skip reset_confirmation promtp when reset_confirmation is defined via extra-vars option (for tests)
* check both string type and object type with user_input for reset_confirmation var

* reset_confirmation_prompt in conjunction with reset_confirmation

improvement inspired by:
https://github.com/kubernetes-sigs/kubespray/pull/10288#issuecomment-1637056880
---
 playbooks/reset.yml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/playbooks/reset.yml b/playbooks/reset.yml
index 654f0a1b7..3f233e0c2 100644
--- a/playbooks/reset.yml
+++ b/playbooks/reset.yml
@@ -25,10 +25,13 @@
       run_once: True
       when:
         - not (skip_confirmation | default(false) | bool)
+        - reset_confirmation is not defined
     - name: Check confirmation
       fail:
         msg: "Reset confirmation failed"
-      when: reset_confirmation != "yes"
+      when:
+        - not reset_confirmation | default(false) | bool
+        - not reset_confirmation_prompt.user_input | default("") == "yes"
 
     - name: Gather information about installed services
       service_facts:
-- 
GitLab