add refresh_pillar and sync_all on retry for jenkins and gerrit states
Related: PROD-16463
Change-Id: I57da7f8b5459f9c58143276c1c768537c82d7f28
diff --git a/src/com/mirantis/mk/Orchestrate.groovy b/src/com/mirantis/mk/Orchestrate.groovy
index 3e6d224..fbb4a6a 100644
--- a/src/com/mirantis/mk/Orchestrate.groovy
+++ b/src/com/mirantis/mk/Orchestrate.groovy
@@ -510,8 +510,26 @@
if (salt.testTarget(master, 'I@python:environment')) {
salt.enforceState(master, 'I@python:environment', 'python', true)
}
- salt.enforceState(master, 'I@gerrit:client', 'gerrit', true, true, null, false, -1, 2)
- salt.enforceState(master, 'I@jenkins:client', 'jenkins', true, true, null, false, -1, 2)
+ withEnv(['ASK_ON_ERROR=false']){
+ retry(2){
+ try{
+ salt.enforceState(master, 'I@gerrit:client', 'gerrit', true)
+ }catch(e){
+ salt.runSaltProcessStep(master, 'I@gerrit:client', 'saltutil.refresh_pillar', [], null, true)
+ salt.runSaltProcessStep(master, 'I@gerrit:client', 'saltutil.sync_all', [], null, true)
+ throw e //rethrow for retry handler
+ }
+ }
+ retry(2){
+ try{
+ salt.enforceState(master, 'I@jenkins:client', 'jenkins', true)
+ }catch(e){
+ salt.runSaltProcessStep(master, 'I@jenkins:client', 'saltutil.refresh_pillar', [], null, true)
+ salt.runSaltProcessStep(master, 'I@jenkins:client', 'saltutil.sync_all', [], null, true)
+ throw e //rethrow for retry handler
+ }
+ }
+ }
}