[SALT] add option to update salt

The OpenStack deploy pipeline should be able to update salt-master and
salt-minion's packages in a proper way (without failing running jobs).
This patch adds such an option to the pipeline.

Closes-Bug: PROD-35355
Closes-Bug: PROD-35233
Change-Id: I91d06e2bddacb4300c425afb756fe7b7fde0fbd5
diff --git a/cloud-deploy-pipeline.groovy b/cloud-deploy-pipeline.groovy
index 144f604..8009b05 100644
--- a/cloud-deploy-pipeline.groovy
+++ b/cloud-deploy-pipeline.groovy
@@ -50,6 +50,7 @@
                                 - 10 - number of nodes
                                 - 10% - percentage of all targeted nodes
  *   DIST_UPGRADE_NODES         Whether to run "apt-get dist-upgrade" on all nodes in cluster before deployment
+ *   UPGRADE_SALTSTACK          Whether to install recent versions of saltstack packages
 
  *
  * Test settings:
@@ -119,6 +120,10 @@
 if (common.validInputParam('DIST_UPGRADE_NODES')) {
     upgrade_nodes = "${DIST_UPGRADE_NODES}".toBoolean()
 }
+def upgrade_salt = false
+if (common.validInputParam('UPGRADE_SALTSTACK')){
+    upgrade_salt = "${UPGRADE_SALTSTACK}".toBoolean()
+}
 
 timeout(time: 12, unit: 'HOURS') {
     node(slave_node) {
@@ -380,6 +385,11 @@
                     }
                     orchestrate.installFoundationInfra(venvPepper, staticMgmtNetwork, extra_tgt, batch_size)
 
+                    if (upgrade_salt) {
+                        debian.upgradeSaltPackages(venvPepper, 'I@salt:master')
+                        debian.upgradeSaltPackages(venvPepper, 'I@salt:minion and not I@salt:master')
+                    }
+
                     if (common.checkContains('STACK_INSTALL', 'kvm')) {
                         if (upgrade_nodes) {
                             debian.osUpgradeNode(venvPepper, 'I@salt:control', 'dist-upgrade', 30, 20, batch_size)