Add tricky steps around salt init

Change-Id: Ied0a263a7c5fc3f40bcc657e0491726ace0c6c82
Bug-related: PROD-21792 (PROD:21792)
diff --git a/config-drive/master_config.yaml b/config-drive/master_config.yaml
index 9adf894..84c3985 100644
--- a/config-drive/master_config.yaml
+++ b/config-drive/master_config.yaml
@@ -123,6 +123,23 @@
       fi
     }
 
+    function process_salt_base(){
+      # PROD-21179| PROD-21792 : To describe such trick's around salt.XX state ordering
+      salt-call ${SALT_OPTS} state.sls salt.master
+      # Wait for salt-master to wake up after restart
+      sleep 5
+      salt-call --timeout=120 test.ping
+      # Run salt.minion.ca to prepare CA certificate before salt.minion.cert is used
+      salt-call ${SALT_OPTS} state.sls salt.minion.ca
+      salt-call ${SALT_OPTS} state.sls salt.minion
+      # Wait for salt-minion to wake up after restart
+      sleep 5
+      salt-call --timeout=120 test.ping
+      salt-call ${SALT_OPTS} state.sls salt
+      salt-call ${SALT_OPTS} state.sls reclass
+    }
+    #== Body ==================================================================#
+
     . /etc/cloud/master_environment
     printenv | sort -u
     process_network
@@ -181,18 +198,7 @@
     fi
 
     salt-call ${SALT_OPTS} state.sls linux.network,linux,openssh
-    # PROD-21179: Run salt.minion.ca to prepare CA certificate before salt.minion.cert is used
-    salt-call ${SALT_OPTS} state.sls salt.minion.ca
-    salt-call ${SALT_OPTS} state.sls salt
-    salt-call ${SALT_OPTS} pkg.install salt-master,salt-minion
-
-    sleep 5
-    # Wait for salt-master and salt-minion to wake up after restart
-    salt-call --timeout=120 test.ping
-
-    salt-call ${SALT_OPTS} state.sls salt
-    salt-call ${SALT_OPTS} state.sls reclass
-
+    process_salt_base
     maas_cluster_enabled=$(salt-call --out=text pillar.get maas:cluster:enabled | awk '{print $2}' | tr "[:upper:]" "[:lower:]" )
     process_maas