Use Pepper instead of sending http request from jenkins master

Change-Id: I2ddfe19ae9c70731989da7ba07fa7720da797721
diff --git a/opencontrail-upgrade.groovy b/opencontrail-upgrade.groovy
index 00b0e7f..7e8412b 100644
--- a/opencontrail-upgrade.groovy
+++ b/opencontrail-upgrade.groovy
@@ -17,8 +17,9 @@
 
 def common = new com.mirantis.mk.Common()
 def salt = new com.mirantis.mk.Salt()
+def python = new com.mirantis.mk.Python()
 
-def saltMaster
+def pepperEnv = "pepperEnv"
 def targetLiveSubset
 def targetLiveAll
 def minions
@@ -34,40 +35,40 @@
 def CMP_PKGS = 'contrail-lib contrail-nodemgr contrail-utils contrail-vrouter-agent contrail-vrouter-utils python-contrail python-contrail-vrouter-api python-opencontrail-vrouter-netns contrail-vrouter-dkms'
 def KERNEL_MODULE_RELOAD = 'service supervisor-vrouter stop;ifdown vhost0;rmmod vrouter;modprobe vrouter;ifup vhost0;service supervisor-vrouter start;'
 
-def void runCommonCommands(target, command, args, check, salt, saltMaster, common) {
+def void runCommonCommands(target, command, args, check, salt, pepperEnv, common) {
 
-    out = salt.runSaltCommand(saltMaster, 'local', ['expression': target, 'type': 'compound'], command, null, args, null)
+    out = salt.runSaltCommand(pepperEnv, 'local', ['expression': target, 'type': 'compound'], command, null, args, null)
     salt.printSaltCommandResult(out)
     // wait until $check is in correct state
     if ( check == "nodetool status" ) {
-        salt.commandStatus(saltMaster, target, check, 'Status=Up')
+        salt.commandStatus(pepperEnv, target, check, 'Status=Up')
     } else if ( check == "contrail-status" ) {
-        salt.commandStatus(saltMaster, target, "${check} | grep -v == | grep -v \'disabled on boot\' | grep -v nodemgr | grep -v active | grep -v backup", null, false)
+        salt.commandStatus(pepperEnv, target, "${check} | grep -v == | grep -v \'disabled on boot\' | grep -v nodemgr | grep -v active | grep -v backup", null, false)
     }
 
-    //out = salt.runSaltCommand(saltMaster, 'local', ['expression': target, 'type': 'compound'], command, null, check, null)
+    //out = salt.runSaltCommand(pepperEnv, 'local', ['expression': target, 'type': 'compound'], command, null, check, null)
     //salt.printSaltCommandResult(out)
     //input message: "Please check the output of \'${check}\' and continue if it is correct."
 }
 
 node() {
 
-    stage('Connect to Salt API') {
-        saltMaster = salt.connection(SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
+    stage('Setup virtualenv for Pepper') {
+        python.setupPepperVirtualenv(venvPepper, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
     }
 
     if (STAGE_CONTROLLERS_UPGRADE.toBoolean() == true && !errorOccured) {
 
         stage('Opencontrail controllers upgrade') {
 
-            oc_component_repo = salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control and *01*', 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
+            oc_component_repo = salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control and *01*', 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
 
             oc_component_repo = oc_component_repo['return'][0].values()[0]
 
             try {
-                salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control', 'cmd.shell', ["rm ${oc_component_repo}"], null, true)
-                salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control', 'saltutil.refresh_pillar', [], null, true)
-                salt.enforceState(saltMaster, 'I@opencontrail:control', 'linux.system.repo')
+                salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control', 'cmd.shell', ["rm ${oc_component_repo}"], null, true)
+                salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control', 'saltutil.refresh_pillar', [], null, true)
+                salt.enforceState(pepperEnv, 'I@opencontrail:control', 'linux.system.repo')
             } catch (Exception er) {
                 errorOccured = true
                 common.errorMsg("Opencontrail component on I@opencontrail:control probably failed to be replaced. Please check it in ${oc_component_repo} before continuing.")
@@ -75,14 +76,14 @@
             }
 
             try {
-                salt.cmdRun(saltMaster, 'I@opencontrail:control', "su root -c '/usr/local/bin/zookeeper-backup-runner.sh'")
+                salt.cmdRun(pepperEnv, 'I@opencontrail:control', "su root -c '/usr/local/bin/zookeeper-backup-runner.sh'")
             } catch (Exception er) {
                 common.errorMsg('Zookeeper failed to backup. Please fix it before continuing.')
                 return
             }
 
             try {
-                salt.cmdRun(saltMaster, 'I@cassandra:backup:client', "su root -c '/usr/local/bin/cassandra-backup-runner-call.sh'")
+                salt.cmdRun(pepperEnv, 'I@cassandra:backup:client', "su root -c '/usr/local/bin/cassandra-backup-runner-call.sh'")
             } catch (Exception er) {
                 common.errorMsg('Cassandra failed to backup. Please fix it before continuing.')
                 return
@@ -92,29 +93,29 @@
             check = 'nodetool status'
 
             // ntw01
-            runCommonCommands('I@opencontrail:control and *01*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:control and *01*', command, args, check, salt, pepperEnv, common)
             // ntw02
-            runCommonCommands('I@opencontrail:control and *02*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:control and *02*', command, args, check, salt, pepperEnv, common)
             // ntw03
-            runCommonCommands('I@opencontrail:control and *03*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:control and *03*', command, args, check, salt, pepperEnv, common)
 
             args = "apt install -o Dpkg::Options::=\"--force-confold\" ${CONTROL_PKGS} -y --force-yes;"
             check = 'contrail-status'
 
             // ntw01
-            runCommonCommands('I@opencontrail:control and *01*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:control and *01*', command, args, check, salt, pepperEnv, common)
             // ntw02
-            runCommonCommands('I@opencontrail:control and *02*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:control and *02*', command, args, check, salt, pepperEnv, common)
             // ntw03
-            runCommonCommands('I@opencontrail:control and *03*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:control and *03*', command, args, check, salt, pepperEnv, common)
 
             try {
-                salt.enforceState(saltMaster, 'I@opencontrail:control', 'opencontrail')
+                salt.enforceState(pepperEnv, 'I@opencontrail:control', 'opencontrail')
             } catch (Exception er) {
                 common.errorMsg('Opencontrail state was executed on I@opencontrail:control and failed please fix it manually.')
             }
 
-            out = salt.runSaltCommand(saltMaster, 'local', ['expression': 'I@opencontrail:control', 'type': 'compound'], command, null, check, null)
+            out = salt.runSaltCommand(pepperEnv, 'local', ['expression': 'I@opencontrail:control', 'type': 'compound'], command, null, check, null)
             salt.printSaltCommandResult(out)
 
             common.warningMsg('Please check \'show bgp summary\' on your bgp router if all bgp peers are in healthy state.')
@@ -129,14 +130,14 @@
 
         stage('Opencontrail analytics upgrade') {
 
-            oc_component_repo = salt.runSaltProcessStep(saltMaster, 'I@opencontrail:collector and *01*', 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
+            oc_component_repo = salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:collector and *01*', 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
 
             oc_component_repo = oc_component_repo['return'][0].values()[0]
 
             try {
-                salt.runSaltProcessStep(saltMaster, 'I@opencontrail:collector', 'cmd.shell', ["rm ${oc_component_repo}"], null, true)
-                salt.runSaltProcessStep(saltMaster, 'I@opencontrail:collector', 'saltutil.refresh_pillar', [], null, true)
-                salt.enforceState(saltMaster, 'I@opencontrail:collector', 'linux.system.repo')
+                salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:collector', 'cmd.shell', ["rm ${oc_component_repo}"], null, true)
+                salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:collector', 'saltutil.refresh_pillar', [], null, true)
+                salt.enforceState(pepperEnv, 'I@opencontrail:collector', 'linux.system.repo')
             } catch (Exception er) {
                 errorOccured = true
                 common.errorMsg("Opencontrail component on I@opencontrail:collector probably failed to be replaced. Please check it in ${oc_component_repo} before continuing.")
@@ -147,29 +148,29 @@
             check = 'nodetool status'
 
             // nal01
-            runCommonCommands('I@opencontrail:collector and *01*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:collector and *01*', command, args, check, salt, pepperEnv, common)
             // nal02
-            runCommonCommands('I@opencontrail:collector and *02*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:collector and *02*', command, args, check, salt, pepperEnv, common)
             // nal03
-            runCommonCommands('I@opencontrail:collector and *03*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:collector and *03*', command, args, check, salt, pepperEnv, common)
 
             args = "apt install -o Dpkg::Options::=\"--force-confold\" ${ANALYTIC_PKGS} -y --force-yes;"
             check = 'contrail-status'
 
             // nal01
-            runCommonCommands('I@opencontrail:collector and *01*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:collector and *01*', command, args, check, salt, pepperEnv, common)
             // nal02
-            runCommonCommands('I@opencontrail:collector and *02*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:collector and *02*', command, args, check, salt, pepperEnv, common)
             // nal03
-            runCommonCommands('I@opencontrail:collector and *03*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:collector and *03*', command, args, check, salt, pepperEnv, common)
 
             try {
-                salt.enforceState(saltMaster, 'I@opencontrail:collector', 'opencontrail')
+                salt.enforceState(pepperEnv, 'I@opencontrail:collector', 'opencontrail')
             } catch (Exception er) {
                 common.errorMsg('Opencontrail state was executed on I@opencontrail:collector and failed please fix it manually.')
             }
 
-            out = salt.runSaltCommand(saltMaster, 'local', ['expression': 'I@opencontrail:collector', 'type': 'compound'], command, null, check, null)
+            out = salt.runSaltCommand(pepperEnv, 'local', ['expression': 'I@opencontrail:collector', 'type': 'compound'], command, null, check, null)
             salt.printSaltCommandResult(out)
         }
     }
@@ -179,7 +180,7 @@
         try {
 
             stage('List targeted compute servers') {
-                minions = salt.getMinions(saltMaster, COMPUTE_TARGET_SERVERS)
+                minions = salt.getMinions(pepperEnv, COMPUTE_TARGET_SERVERS)
 
                 if (minions.isEmpty()) {
                     throw new Exception("No minion was targeted")
@@ -199,13 +200,13 @@
 
             stage("Opencontrail compute upgrade on sample nodes") {
 
-                oc_component_repo = salt.runSaltProcessStep(saltMaster, targetLiveSubset, 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
+                oc_component_repo = salt.runSaltProcessStep(pepperEnv, targetLiveSubset, 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
                 oc_component_repo = oc_component_repo['return'][0].values()[0]
 
                 try {
-                    salt.runSaltProcessStep(saltMaster, targetLiveSubset, 'cmd.shell', ["rm ${oc_component_repo}"], null, true)
-                    salt.runSaltProcessStep(saltMaster, targetLiveSubset, 'saltutil.refresh_pillar', [], null, true)
-                    salt.enforceState(saltMaster, targetLiveSubset, 'linux.system.repo')
+                    salt.runSaltProcessStep(pepperEnv, targetLiveSubset, 'cmd.shell', ["rm ${oc_component_repo}"], null, true)
+                    salt.runSaltProcessStep(pepperEnv, targetLiveSubset, 'saltutil.refresh_pillar', [], null, true)
+                    salt.enforceState(pepperEnv, targetLiveSubset, 'linux.system.repo')
                 } catch (Exception er) {
                     errorOccured = true
                     common.errorMsg("Opencontrail component on ${targetLiveSubset} probably failed to be replaced. Please check it in ${oc_component_repo} before continuing.")
@@ -215,21 +216,21 @@
                 args = "export DEBIAN_FRONTEND=noninteractive; apt install -o Dpkg::Options::=\"--force-confold\" -o Dpkg::Options::=\"--force-confdef\" ${CMP_PKGS}  -y;"
                 check = 'contrail-status'
 
-                out = salt.runSaltCommand(saltMaster, 'local', ['expression': targetLiveSubset, 'type': 'compound'], command, null, args, null)
+                out = salt.runSaltCommand(pepperEnv, 'local', ['expression': targetLiveSubset, 'type': 'compound'], command, null, args, null)
                 salt.printSaltCommandResult(out)
 
                 try {
-                    salt.enforceState(saltMaster, targetLiveSubset, 'opencontrail')
+                    salt.enforceState(pepperEnv, targetLiveSubset, 'opencontrail')
                 } catch (Exception er) {
                     common.errorMsg("Opencontrail state was executed on ${targetLiveSubset} and failed please fix it manually.")
                 }
 
-                salt.runSaltProcessStep(saltMaster, targetLiveSubset, 'cmd.shell', ["${KERNEL_MODULE_RELOAD}"], null, true)
+                salt.runSaltProcessStep(pepperEnv, targetLiveSubset, 'cmd.shell', ["${KERNEL_MODULE_RELOAD}"], null, true)
 
                 //sleep(10)
-                salt.commandStatus(saltMaster, targetLiveSubset, "${check} | grep -v == | grep -v active", null, false)
+                salt.commandStatus(pepperEnv, targetLiveSubset, "${check} | grep -v == | grep -v active", null, false)
 
-                out = salt.runSaltCommand(saltMaster, 'local', ['expression': targetLiveSubset, 'type': 'compound'], command, null, check, null)
+                out = salt.runSaltCommand(pepperEnv, 'local', ['expression': targetLiveSubset, 'type': 'compound'], command, null, check, null)
                 salt.printSaltCommandResult(out)
             }
 
@@ -238,13 +239,13 @@
             }
             stage("Opencontrail compute upgrade on all targeted nodes") {
 
-                oc_component_repo = salt.runSaltProcessStep(saltMaster, targetLiveAll, 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
+                oc_component_repo = salt.runSaltProcessStep(pepperEnv, targetLiveAll, 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
                 oc_component_repo = oc_component_repo['return'][0].values()[0]
 
                 try {
-                    salt.runSaltProcessStep(saltMaster, targetLiveAll, 'cmd.shell', ["rm ${oc_component_repo}"], null, true)
-                    salt.runSaltProcessStep(saltMaster, targetLiveAll, 'saltutil.refresh_pillar', [], null, true)
-                    salt.enforceState(saltMaster, targetLiveAll, 'linux.system.repo')
+                    salt.runSaltProcessStep(pepperEnv, targetLiveAll, 'cmd.shell', ["rm ${oc_component_repo}"], null, true)
+                    salt.runSaltProcessStep(pepperEnv, targetLiveAll, 'saltutil.refresh_pillar', [], null, true)
+                    salt.enforceState(pepperEnv, targetLiveAll, 'linux.system.repo')
                 } catch (Exception er) {
                     common.errorMsg("Opencontrail component on ${targetLiveAll} probably failed to be replaced. Please check it in ${oc_component_repo} before continuing.")
                     return
@@ -253,20 +254,20 @@
                 args = "export DEBIAN_FRONTEND=noninteractive; apt install -o Dpkg::Options::=\"--force-confold\" -o Dpkg::Options::=\"--force-confdef\" ${CMP_PKGS}  -y;"
                 check = 'contrail-status'
 
-                out = salt.runSaltCommand(saltMaster, 'local', ['expression': targetLiveAll, 'type': 'compound'], command, null, args, null)
+                out = salt.runSaltCommand(pepperEnv, 'local', ['expression': targetLiveAll, 'type': 'compound'], command, null, args, null)
                 salt.printSaltCommandResult(out)
 
                 try {
-                    salt.enforceState(saltMaster, targetLiveAll, 'opencontrail')
+                    salt.enforceState(pepperEnv, targetLiveAll, 'opencontrail')
                 } catch (Exception er) {
                     common.errorMsg("Opencontrail state was executed on ${targetLiveAll} and failed please fix it manually.")
                 }
 
-                salt.runSaltProcessStep(saltMaster, targetLiveAll, 'cmd.shell', ["${KERNEL_MODULE_RELOAD}"], null, true)
+                salt.runSaltProcessStep(pepperEnv, targetLiveAll, 'cmd.shell', ["${KERNEL_MODULE_RELOAD}"], null, true)
                 //sleep(10)
-                salt.commandStatus(saltMaster, targetLiveAll, "${check} | grep -v == | grep -v active", null, false)
+                salt.commandStatus(pepperEnv, targetLiveAll, "${check} | grep -v == | grep -v active", null, false)
 
-                out = salt.runSaltCommand(saltMaster, 'local', ['expression': targetLiveAll, 'type': 'compound'], command, null, check, null)
+                out = salt.runSaltCommand(pepperEnv, 'local', ['expression': targetLiveAll, 'type': 'compound'], command, null, check, null)
                 salt.printSaltCommandResult(out)
             }
 
@@ -287,13 +288,13 @@
 
        stage('Opencontrail controllers rollback') {
 
-            oc_component_repo = salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control and *01*', 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
+            oc_component_repo = salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control and *01*', 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
             oc_component_repo = oc_component_repo['return'][0].values()[0]
 
             try {
-                salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control', 'cmd.shell', ["rm ${oc_component_repo}"], null, true)
-                salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control', 'saltutil.refresh_pillar', [], null, true)
-                salt.enforceState(saltMaster, 'I@opencontrail:control', 'linux.system.repo')
+                salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control', 'cmd.shell', ["rm ${oc_component_repo}"], null, true)
+                salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control', 'saltutil.refresh_pillar', [], null, true)
+                salt.enforceState(pepperEnv, 'I@opencontrail:control', 'linux.system.repo')
             } catch (Exception er) {
                 errorOccured = true
                 common.errorMsg("Opencontrail component on I@opencontrail:control probably failed to be replaced. Please check it in ${oc_component_repo} before continuing.")
@@ -304,29 +305,29 @@
             check = 'nodetool status'
 
             // ntw01
-            runCommonCommands('I@opencontrail:control and *01*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:control and *01*', command, args, check, salt, pepperEnv, common)
             // ntw02
-            runCommonCommands('I@opencontrail:control and *02*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:control and *02*', command, args, check, salt, pepperEnv, common)
             // ntw03
-            runCommonCommands('I@opencontrail:control and *03*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:control and *03*', command, args, check, salt, pepperEnv, common)
 
             args = "apt install -o Dpkg::Options::=\"--force-confold\" ${CONTROL_PKGS} -y --force-yes;"
             check = 'contrail-status'
 
             // ntw01
-            runCommonCommands('I@opencontrail:control and *01*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:control and *01*', command, args, check, salt, pepperEnv, common)
             // ntw02
-            runCommonCommands('I@opencontrail:control and *02*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:control and *02*', command, args, check, salt, pepperEnv, common)
             // ntw03
-            runCommonCommands('I@opencontrail:control and *03*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:control and *03*', command, args, check, salt, pepperEnv, common)
 
             try {
-                salt.enforceState(saltMaster, 'I@opencontrail:control', 'opencontrail')
+                salt.enforceState(pepperEnv, 'I@opencontrail:control', 'opencontrail')
             } catch (Exception er) {
                 common.errorMsg('Opencontrail state was executed on I@opencontrail:control and failed please fix it manually.')
             }
 
-            out = salt.runSaltCommand(saltMaster, 'local', ['expression': 'I@opencontrail:control', 'type': 'compound'], command, null, check, null)
+            out = salt.runSaltCommand(pepperEnv, 'local', ['expression': 'I@opencontrail:control', 'type': 'compound'], command, null, check, null)
             salt.printSaltCommandResult(out)
 
             common.warningMsg('Please check \'show bgp summary\' on your bgp router if all bgp peers are in healthy state.')
@@ -341,13 +342,13 @@
 
         stage('Opencontrail analytics rollback') {
 
-            oc_component_repo = salt.runSaltProcessStep(saltMaster, 'I@opencontrail:collector and *01*', 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
+            oc_component_repo = salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:collector and *01*', 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
             oc_component_repo = oc_component_repo['return'][0].values()[0]
 
             try {
-                salt.runSaltProcessStep(saltMaster, 'I@opencontrail:collector', 'cmd.shell', ["rm ${oc_component_repo}"], null, true)
-                salt.runSaltProcessStep(saltMaster, 'I@opencontrail:collector', 'saltutil.refresh_pillar', [], null, true)
-                salt.enforceState(saltMaster, 'I@opencontrail:collector', 'linux.system.repo')
+                salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:collector', 'cmd.shell', ["rm ${oc_component_repo}"], null, true)
+                salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:collector', 'saltutil.refresh_pillar', [], null, true)
+                salt.enforceState(pepperEnv, 'I@opencontrail:collector', 'linux.system.repo')
             } catch (Exception er) {
                 errorOccured = true
                 common.errorMsg("Opencontrail component on I@opencontrail:collector probably failed to be replaced. Please check it in ${oc_component_repo} before continuing.")
@@ -358,29 +359,29 @@
             check = 'nodetool status'
 
             // nal01
-            runCommonCommands('I@opencontrail:collector and *01*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:collector and *01*', command, args, check, salt, pepperEnv, common)
             // nal02
-            runCommonCommands('I@opencontrail:collector and *02*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:collector and *02*', command, args, check, salt, pepperEnv, common)
             // nal03
-            runCommonCommands('I@opencontrail:collector and *03*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:collector and *03*', command, args, check, salt, pepperEnv, common)
 
             args = "apt install -o Dpkg::Options::=\"--force-confold\" ${ANALYTIC_PKGS} -y --force-yes;"
             check = 'contrail-status'
 
             // nal01
-            runCommonCommands('I@opencontrail:collector and *01*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:collector and *01*', command, args, check, salt, pepperEnv, common)
             // nal02
-            runCommonCommands('I@opencontrail:collector and *02*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:collector and *02*', command, args, check, salt, pepperEnv, common)
             // nal03
-            runCommonCommands('I@opencontrail:collector and *03*', command, args, check, salt, saltMaster, common)
+            runCommonCommands('I@opencontrail:collector and *03*', command, args, check, salt, pepperEnv, common)
 
             try {
-                salt.enforceState(saltMaster, 'I@opencontrail:collector', 'opencontrail')
+                salt.enforceState(pepperEnv, 'I@opencontrail:collector', 'opencontrail')
             } catch (Exception er) {
                 common.errorMsg('Opencontrail state was executed on I@opencontrail:collector and failed please fix it manually.')
             }
 
-            out = salt.runSaltCommand(saltMaster, 'local', ['expression': 'I@opencontrail:collector', 'type': 'compound'], command, null, check, null)
+            out = salt.runSaltCommand(pepperEnv, 'local', ['expression': 'I@opencontrail:collector', 'type': 'compound'], command, null, check, null)
             salt.printSaltCommandResult(out)
         }
     }
@@ -390,7 +391,7 @@
         try {
 
             stage('List targeted compute servers') {
-                minions = salt.getMinions(saltMaster, COMPUTE_TARGET_SERVERS)
+                minions = salt.getMinions(pepperEnv, COMPUTE_TARGET_SERVERS)
 
                 if (minions.isEmpty()) {
                     throw new Exception("No minion was targeted")
@@ -410,13 +411,13 @@
 
             stage("Opencontrail compute rollback on sample nodes") {
 
-                oc_component_repo = salt.runSaltProcessStep(saltMaster, targetLiveSubset, 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
+                oc_component_repo = salt.runSaltProcessStep(pepperEnv, targetLiveSubset, 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
                 oc_component_repo = oc_component_repo['return'][0].values()[0]
 
                 try {
-                    salt.runSaltProcessStep(saltMaster, targetLiveSubset, 'cmd.shell', ["rm ${oc_component_repo}"], null, true)
-                    salt.runSaltProcessStep(saltMaster, targetLiveSubset, 'saltutil.refresh_pillar', [], null, true)
-                    salt.enforceState(saltMaster, targetLiveSubset, 'linux.system.repo')
+                    salt.runSaltProcessStep(pepperEnv, targetLiveSubset, 'cmd.shell', ["rm ${oc_component_repo}"], null, true)
+                    salt.runSaltProcessStep(pepperEnv, targetLiveSubset, 'saltutil.refresh_pillar', [], null, true)
+                    salt.enforceState(pepperEnv, targetLiveSubset, 'linux.system.repo')
                 } catch (Exception er) {
                     errorOccured = true
                     common.errorMsg("Opencontrail component on ${targetLiveSubset} probably failed to be replaced. Please check it in ${oc_component_repo} before continuing.")
@@ -426,20 +427,20 @@
                 args = "export DEBIAN_FRONTEND=noninteractive; apt install --allow-downgrades -o Dpkg::Options::=\"--force-confold\" -o Dpkg::Options::=\"--force-confdef\" ${CMP_PKGS}  -y;"
                 check = 'contrail-status'
 
-                out = salt.runSaltCommand(saltMaster, 'local', ['expression': targetLiveSubset, 'type': 'compound'], command, null, args, null)
+                out = salt.runSaltCommand(pepperEnv, 'local', ['expression': targetLiveSubset, 'type': 'compound'], command, null, args, null)
                 salt.printSaltCommandResult(out)
 
                 try {
-                    salt.enforceState(saltMaster, targetLiveSubset, 'opencontrail')
+                    salt.enforceState(pepperEnv, targetLiveSubset, 'opencontrail')
                 } catch (Exception er) {
                     common.errorMsg("Opencontrail state was executed on ${targetLiveSubset} and failed please fix it manually.")
                 }
 
-                salt.runSaltProcessStep(saltMaster, targetLiveSubset, 'cmd.shell', ["${KERNEL_MODULE_RELOAD}"], null, true)
+                salt.runSaltProcessStep(pepperEnv, targetLiveSubset, 'cmd.shell', ["${KERNEL_MODULE_RELOAD}"], null, true)
                 //sleep(10)
-                salt.commandStatus(saltMaster, targetLiveSubset, "${check} | grep -v == | grep -v active", null, false)
+                salt.commandStatus(pepperEnv, targetLiveSubset, "${check} | grep -v == | grep -v active", null, false)
 
-                out = salt.runSaltCommand(saltMaster, 'local', ['expression': targetLiveSubset, 'type': 'compound'], command, null, check, null)
+                out = salt.runSaltCommand(pepperEnv, 'local', ['expression': targetLiveSubset, 'type': 'compound'], command, null, check, null)
                 salt.printSaltCommandResult(out)
             }
 
@@ -449,13 +450,13 @@
 
             stage("Opencontrail compute upgrade on all targeted nodes") {
 
-                oc_component_repo = salt.runSaltProcessStep(saltMaster, targetLiveAll, 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
+                oc_component_repo = salt.runSaltProcessStep(pepperEnv, targetLiveAll, 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
                 oc_component_repo = oc_component_repo['return'][0].values()[0]
 
                 try {
-                    salt.runSaltProcessStep(saltMaster, targetLiveAll, 'cmd.shell', ["rm ${oc_component_repo}"], null, true)
-                    salt.runSaltProcessStep(saltMaster, targetLiveAll, 'saltutil.refresh_pillar', [], null, true)
-                    salt.enforceState(saltMaster, targetLiveAll, 'linux.system.repo')
+                    salt.runSaltProcessStep(pepperEnv, targetLiveAll, 'cmd.shell', ["rm ${oc_component_repo}"], null, true)
+                    salt.runSaltProcessStep(pepperEnv, targetLiveAll, 'saltutil.refresh_pillar', [], null, true)
+                    salt.enforceState(pepperEnv, targetLiveAll, 'linux.system.repo')
                 } catch (Exception er) {
                     common.errorMsg("Opencontrail component on ${targetLiveAll} probably failed to be replaced. Please check it in ${oc_component_repo} before continuing.")
                     return
@@ -464,21 +465,21 @@
                 args = "export DEBIAN_FRONTEND=noninteractive; apt install --allow-downgrades -o Dpkg::Options::=\"--force-confold\" -o Dpkg::Options::=\"--force-confdef\" ${CMP_PKGS} -y;"
                 check = 'contrail-status'
 
-                out = salt.runSaltCommand(saltMaster, 'local', ['expression': targetLiveAll, 'type': 'compound'], command, null, args, null)
+                out = salt.runSaltCommand(pepperEnv, 'local', ['expression': targetLiveAll, 'type': 'compound'], command, null, args, null)
                 salt.printSaltCommandResult(out)
 
                 try {
-                    salt.enforceState(saltMaster, targetLiveAll, 'opencontrail')
+                    salt.enforceState(pepperEnv, targetLiveAll, 'opencontrail')
                 } catch (Exception er) {
                     common.errorMsg("Opencontrail state was executed on ${targetLiveAll} and failed please fix it manually.")
                 }
 
-                salt.runSaltProcessStep(saltMaster, targetLiveAll, 'cmd.shell', ["${KERNEL_MODULE_RELOAD}"], null, true)
+                salt.runSaltProcessStep(pepperEnv, targetLiveAll, 'cmd.shell', ["${KERNEL_MODULE_RELOAD}"], null, true)
 
                 //sleep(10)
-                salt.commandStatus(saltMaster, targetLiveAll, "${check} | grep -v == | grep -v active", null, false)
+                salt.commandStatus(pepperEnv, targetLiveAll, "${check} | grep -v == | grep -v active", null, false)
 
-                out = salt.runSaltCommand(saltMaster, 'local', ['expression': targetLiveAll, 'type': 'compound'], command, null, check, null)
+                out = salt.runSaltCommand(pepperEnv, 'local', ['expression': targetLiveAll, 'type': 'compound'], command, null, check, null)
                 salt.printSaltCommandResult(out)
             }