Merge "Refactoring in pipelines to better use salt.groovy lib code"
diff --git a/cicd-lab-pipeline.groovy b/cicd-lab-pipeline.groovy
index 6236f2a..da3e177 100644
--- a/cicd-lab-pipeline.groovy
+++ b/cicd-lab-pipeline.groovy
@@ -181,7 +181,7 @@
                 }
                 // XXX: Workaround to have `/var/lib/jenkins` on all
                 // nodes where are jenkins_slave services are created.
-                salt.runSaltProcessStep(pepperEnv, 'I@docker:swarm', 'cmd.run', ['mkdir -p /var/lib/jenkins'])
+                salt.cmdRun(pepperEnv, 'I@docker:swarm', "mkdir -p /var/lib/jenkins")
             }
 
             stage("Configure CI/CD services") {
diff --git a/cloud-deploy-pipeline.groovy b/cloud-deploy-pipeline.groovy
index 41c08ab..13031c0 100644
--- a/cloud-deploy-pipeline.groovy
+++ b/cloud-deploy-pipeline.groovy
@@ -388,8 +388,8 @@
                         orchestrate.installOpenstackNetwork(venvPepper)
                     }
 
-                    salt.runSaltProcessStep(venvPepper, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; neutron net-list'])
-                    salt.runSaltProcessStep(venvPepper, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; nova net-list'])
+                    salt.cmdRun(venvPepper, 'I@keystone:server', '. /root/keystonerc; neutron net-list')
+                    salt.cmdRun(venvPepper, 'I@keystone:server', '. /root/keystonerc; nova net-list')
                 }
 
                 if (salt.testTarget(venvPepper, 'I@ironic:conductor')){
diff --git a/kafka-demo.groovy b/kafka-demo.groovy
index d884713..87f20ed 100644
--- a/kafka-demo.groovy
+++ b/kafka-demo.groovy
@@ -24,23 +24,20 @@
         stage("Enforce kubernetes.control") {
             common.infoMsg('Enforcing kubernetes.control on I@kubernetes:master')
 
-            salt.runSaltProcessStep(
+            salt.enforceState(
                 master,
                 'I@kubernetes:master',
-                'state.sls',
-                ['kubernetes.control'],
+                'kubernetes.control'
             )
         }
 
         stage("setup-components") {
             common.infoMsg('Setting up components')
 
-            salt.runSaltProcessStep(
+            salt.cmdRun(
                 master,
                 'I@kubernetes:master',
-                'cmd.run',
-                ['/bin/bash -c \'find /srv/kubernetes/ -type d | grep -v jobs | while read i; do ls $i/*.yml &>/dev/null && (set -x; hyperkube kubectl apply -f $i || echo Command failed; set +x); done;\'']
-            )
+                '/bin/bash -c \'find /srv/kubernetes/ -type d | grep -v jobs | while read i; do ls $i/*.yml &>/dev/null && (set -x; hyperkube kubectl apply -f $i || echo Command failed; set +x); done;\'')
 
         }
 
diff --git a/lab-pipeline.groovy b/lab-pipeline.groovy
index 06dc48e..61015f5 100644
--- a/lab-pipeline.groovy
+++ b/lab-pipeline.groovy
@@ -248,8 +248,8 @@
                     orchestrate.installOpenstackNetwork(saltMaster)
                 }
 
-                salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; neutron net-list'])
-                salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; nova net-list'])
+                salt.cmdRun(saltMaster, 'I@keystone:server', '. /root/keystonerc; neutron net-list')
+                salt.cmdRun(saltMaster, 'I@keystone:server', '. /root/keystonerc; nova net-list')
             }
 
             if (salt.testTarget(saltMaster, 'I@ironic:conductor')){
diff --git a/update-mirror-image.groovy b/update-mirror-image.groovy
index 8bde843..e37d537 100644
--- a/update-mirror-image.groovy
+++ b/update-mirror-image.groovy
@@ -70,16 +70,16 @@
             if(UPDATE_DOCKER_REGISTRY.toBoolean()){
                 stage('Update Docker images'){
                     common.infoMsg("Updating Docker images.")
-                    salt.enforceState(venvPepper, '*apt*', ['docker.client.registry'], true)
+                    salt.enforceState(venvPepper, '*apt*', 'docker.client.registry')
                     if(CLEANUP_DOCKER_CACHE.toBoolean()){
-                        salt.runSaltProcessStep(venvPepper, '*apt*', 'cmd.run', ['docker system prune --all --force'], null, true)
+                        salt.cmdRun(venvPepper, '*apt*', 'docker system prune --all --force')
                     }
                 }
             }
             if(UPDATE_PYPI.toBoolean()){
                 stage('Update PyPi packages'){
                     common.infoMsg("Updating PyPi packages.")
-                    salt.runSaltProcessStep(venvPepper, '*apt*', 'cmd.run', ['pip2pi /srv/pypi_mirror/packages/ -r /srv/pypi_mirror/requirements.txt'], null, true)
+                    salt.cmdRun(venvPepper, '*apt*', 'pip2pi /srv/pypi_mirror/packages/ -r /srv/pypi_mirror/requirements.txt')
                 }
             }
             if(UPDATE_GIT.toBoolean()){
@@ -91,7 +91,7 @@
             if(UPDATE_IMAGES.toBoolean()){
                 stage('Update VM images'){
                     common.infoMsg("Updating VM images.")
-                    salt.runSaltProcessStep(venvPepper, '*apt*', 'cmd.run', ['/srv/scripts/update-images.sh'], null, true)
+                    salt.runSaltProcessStep(venvPepper, '*apt*', '/srv/scripts/update-images.sh')
                 }
             }
         } catch (Throwable e) {
@@ -101,4 +101,4 @@
             throw e
         }
     }
-}
\ No newline at end of file
+}
diff --git a/upgrade-mcp-release.groovy b/upgrade-mcp-release.groovy
index 0efc83d..d423347 100644
--- a/upgrade-mcp-release.groovy
+++ b/upgrade-mcp-release.groovy
@@ -22,7 +22,7 @@
             stage("Update Reclass"){
                 common.infoMsg("Updating reclass model")
                 salt.cmdRun(venvPepper, "I@salt:master", 'cd /srv/salt/reclass && git pull -r && git submodule update', false)
-                salt.runSaltProcessStep(venvPepper, 'I@salt:master', 'cmd.run', ['reclass-salt --top'], null, true)
+                salt.cmdRun(venvPepper, 'I@salt:master', 'reclass-salt --top')
                 salt.enforceState(venvPepper, "I@salt:master", 'reclass', true)
             }
 
@@ -65,4 +65,4 @@
             throw e
         }
     }
-}
\ No newline at end of file
+}