Add temporary fix for offline deployment unable to use newer pepper

Change-Id: Icffde6ae1c6c9410df9d37de43f7b4a0e28a5d0d
diff --git a/src/com/mirantis/mk/Python.groovy b/src/com/mirantis/mk/Python.groovy
index b6e408a..e5a6023 100644
--- a/src/com/mirantis/mk/Python.groovy
+++ b/src/com/mirantis/mk/Python.groovy
@@ -306,7 +306,13 @@
     // requirements = ['salt-pepper']
     requirements = []
     setupVirtualenv(path, 'python2', requirements, null, clean, true)
-    runVirtualenvCommand(path, "pip install git+https://github.com/chnyda/pepper.git")
+
+    try {
+        runVirtualenvCommand(path, "wget -q -T 3 --spider http://google.com && pip install git+https://github.com/saltstack/pepper.git")
+    } catch(Exception e) {
+        common.warningMsg("Setuptools and pip cannot be updated, you might be offline")
+        runVirtualenvCommand(path, "pip install salt-pepper")
+    }
 
     // pepperrc creation
     rcFile = "${path}/pepperrc"
diff --git a/src/com/mirantis/mk/Salt.groovy b/src/com/mirantis/mk/Salt.groovy
index 00d90ec..7451f34 100644
--- a/src/com/mirantis/mk/Salt.groovy
+++ b/src/com/mirantis/mk/Salt.groovy
@@ -664,9 +664,22 @@
     def python = new com.mirantis.mk.Python()
     def dataStr = new groovy.json.JsonBuilder(data).toString()
 
-    pepperCmdFile = "${venv}/pepper-cmd.json"
-    writeFile file: pepperCmdFile, text: dataStr
-    def pepperCmd = "pepper -c ${venv}/pepperrc --make-token -x ${venv}/.peppercache --json-file ${pepperCmdFile}"
+    def offlineDeployment = false
+    try {
+        offlineDeployment = sh(script: "wget -q -T 3 --spider http://google.com", returnStatus: true) != 0
+    } catch(Exception e) {
+        common.warningMsg("You might be offline, will use pepper with option --json instead of option --json-file")
+    }
+
+    def pepperCmd
+
+    if (!offlineDeployment) {
+        def pepperCmdFile = "${venv}/pepper-cmd.json"
+        writeFile file: pepperCmdFile, text: dataStr
+        pepperCmd = "pepper -c ${venv}/pepperrc --make-token -x ${venv}/.peppercache --json-file ${pepperCmdFile}"
+    } else {
+        pepperCmd = "pepper -c ${venv}/pepperrc --make-token -x ${venv}/.peppercache --json \"" + dataStr + "\""
+    }
 
     if (venv) {
         output = python.runVirtualenvCommand(venv, pepperCmd)