Run update for salt packages in upgrade trivetrain job twice
Salt package update from first run will update all packages and restart
services and as a result pepper will lost connection with old token and
fail job. To avoid this fail, run update package from salt one more time,
but update pepper env before that. Thus, second run will do anything,
but pepper will have update token and continue working.
Related-bug: PROD-25133
Change-Id: Ia04f2b4f3af3e198029af11ede3d7e15279281d6
diff --git a/upgrade-mcp-release.groovy b/upgrade-mcp-release.groovy
index 59659ab..445c097 100644
--- a/upgrade-mcp-release.groovy
+++ b/upgrade-mcp-release.groovy
@@ -208,7 +208,13 @@
if (UPGRADE_SALTSTACK.toBoolean()) {
salt.enforceState(venvPepper, "I@linux:system", 'linux.system.repo', true)
- updateSaltStack("I@salt:master", '["salt-master", "salt-common", "salt-api", "salt-minion"]')
+ // as salt package update leads to service restart and token changing - re-create pepperEnv and rerun package update
+ try {
+ updateSaltStack("I@salt:master", '["salt-master", "salt-common", "salt-api", "salt-minion"]')
+ } catch (Exception e) {
+ python.setupPepperVirtualenv(venvPepper, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
+ updateSaltStack("I@salt:master", '["salt-master", "salt-common", "salt-api", "salt-minion"]')
+ }
updateSaltStack("I@salt:minion and not I@salt:master", '["salt-minion"]')
}