Restart apache on kmn nodes after barbican.server state

nssdb will be initialized by barbican-api and barbican-worker
races are possible during db initialization and permanent fix
suppose to be https://gerrit.mcp.mirantis.com/#/c/35097/
But due to rash in release we don't have time to make sure that fix is
permanent, so we need to restart apache after barbican.server is applied
to avoid non-working barbican-api.

This workaround will be removed after release.

Change-Id: Ia074123aada95f2abcde08fea672e77a7536f472
Related-Prod: PROD-26988
diff --git a/src/com/mirantis/mk/Orchestrate.groovy b/src/com/mirantis/mk/Orchestrate.groovy
index a62503f..c6d262a 100644
--- a/src/com/mirantis/mk/Orchestrate.groovy
+++ b/src/com/mirantis/mk/Orchestrate.groovy
@@ -394,6 +394,16 @@
     salt.enforceStateWithTest([saltId: master, target: "I@barbican:server:role:primary ${extra_tgt}", state: 'barbican.server', testTargetMatcher: "I@barbican:server ${extra_tgt}"])
     salt.enforceStateWithTest([saltId: master, target: "I@barbican:server ${extra_tgt}", state: 'barbican.server'])
 
+    if (salt.testTarget(master, "I@barbican:server ${extra_tgt}")) {
+      // Restart apache to make sure we don't have races between barbican-api and barbican-worker on db init.
+      // For more info please see PROD-26988
+      // The permanent fix is prepared to barbican formula https://gerrit.mcp.mirantis.com/#/c/35097/ but due to rush in release
+      // add this workaround here as well.
+      // TODO(vsaienko): cleanup once release passed in favor of permanent fix.
+      salt.runSaltProcessStep(master, "I@barbican:server ${extra_tgt}", 'service.restart', ['apache2'])
+      sleep(30)
+    }
+
     // Install barbican client
     salt.enforceStateWithTest([saltId: master, target: "I@barbican:client ${extra_tgt}", state: 'barbican.client'])