MCP update Procedure. Check password existing before the applying the workaround. PROD-36092

Change-Id: I8108752e30af487ef34593931a17f5f7119fac59
diff --git a/tcp_tests/tests/system/test_mcp_update.py b/tcp_tests/tests/system/test_mcp_update.py
index 72ed442..12d2aa8 100644
--- a/tcp_tests/tests/system/test_mcp_update.py
+++ b/tcp_tests/tests/system/test_mcp_update.py
@@ -98,41 +98,49 @@
 @pytest.fixture
 def wa_for_galera_clustercheck_password_prod35705(reclass_actions,
                                                   salt_actions):
-    reclass_actions.add_key(
-        "parameters._param.galera_clustercheck_password",
-        "a"*32,
-        "cluster/*/infra/secrets.yml")
-    salt_actions.run_state(
-        "I@galera:master or I@galera:slave", "saltutil.refresh_pillar")
-    salt_actions.enforce_state(
-        "I@galera:master or I@galera:slave", "galera")
-    salt_actions.enforce_state(
-        "I@galera:master or I@galera:slave", "haproxy")
-    reclass_actions.commit("[from TCP-QA] Add galera_clustercheck_password")
+    tgt = "I@galera:master or I@galera:slave"
+    if not salt_actions.get_pillar(tgt,
+                                   "_param:galera_clustercheck_password")[0]:
+        reclass_actions.add_key(
+            "parameters._param.galera_clustercheck_password",
+            "a"*32,
+            "cluster/*/infra/secrets.yml")
+        salt_actions.run_state(tgt, "saltutil.refresh_pillar")
+        salt_actions.enforce_state(tgt, "galera")
+        salt_actions.enforce_state(tgt, "haproxy")
+        reclass_actions.commit(
+          "[from TCP-QA] Add galera_clustercheck_password")
+    else:
+        LOG.info("Skipping WA for Galera Clustercheck Password")
 
 
 @pytest.fixture
 def wa_for_alerta_password_prod35958(reclass_actions,
                                      salt_actions):
-    reclass_actions.add_key(
-        "parameters._param.alerta_admin_api_key_generated",
-        "a"*32,
-        "cluster/*/infra/secrets.yml")
-    reclass_actions.add_key(
-        "parameters._param.alerta_admin_key",
-        "${_param:alerta_admin_api_key_generated}",
-        "cluster/*/stacklight/init.yml")
-    reclass_actions.commit("[from TCP-QA] Add alerta_admin_key")
-    salt_actions.run_state(
-        "I@prometheus:alerta or I@prometheus:alertmanager",
-        "saltutil.refresh_pillar")
-    salt_actions.enforce_state(
-        "I@prometheus:alerta", "prometheus.alerta")
-    salt_actions.enforce_state(
-        "I@prometheus:alertmanager", "prometheus.alertmanager")
-    salt_actions.enforce_state(
-        "I@prometheus:alerta or I@prometheus:alertmanager",
-        "docker.client")
+
+    if not salt_actions.get_pillar("I@prometheus:alerta",
+                                   "_param:alerta_admin_api_key_generated")[0]:
+        reclass_actions.add_key(
+            "parameters._param.alerta_admin_api_key_generated",
+            "a"*32,
+            "cluster/*/infra/secrets.yml")
+        reclass_actions.add_key(
+            "parameters._param.alerta_admin_key",
+            "${_param:alerta_admin_api_key_generated}",
+            "cluster/*/stacklight/init.yml")
+        reclass_actions.commit("[from TCP-QA] Add alerta_admin_key")
+        salt_actions.run_state(
+            "I@prometheus:alerta or I@prometheus:alertmanager",
+            "saltutil.refresh_pillar")
+        salt_actions.enforce_state(
+            "I@prometheus:alerta", "prometheus.alerta")
+        salt_actions.enforce_state(
+            "I@prometheus:alertmanager", "prometheus.alertmanager")
+        salt_actions.enforce_state(
+            "I@prometheus:alerta or I@prometheus:alertmanager",
+            "docker.client")
+    else:
+        LOG.info("Skipping WA for Alerta API key")
 
 
 @pytest.fixture(scope='class')