Refactoring in salt and python utils for offline deployment
Change-Id: I183b56a6eafb715aae2e896ff8bb1d3da79760d1
diff --git a/src/com/mirantis/mk/Python.groovy b/src/com/mirantis/mk/Python.groovy
index e5a6023..ebb6fc9 100644
--- a/src/com/mirantis/mk/Python.groovy
+++ b/src/com/mirantis/mk/Python.groovy
@@ -28,10 +28,13 @@
common.infoMsg("[Python ${path}] Setup ${python} environment")
sh(returnStdout: true, script: virtualenv_cmd)
- try {
- runVirtualenvCommand(path, "wget -q -T 3 --spider http://google.com && pip install -U setuptools pip")
- } catch(Exception e) {
- common.warningMsg("Setuptools and pip cannot be updated, you might be offline")
+ if(!env.getEnvironment().containsKey("OFFLINE_DEPLOYMENT") || !env["OFFLINE_DEPLOYMENT"].toBoolean()){
+ try {
+ //TODO: remove wget after global env prop enforcments
+ runVirtualenvCommand(path, "wget -q -T 3 --spider http://google.com && pip install -U setuptools pip")
+ } catch(Exception e) {
+ common.warningMsg("Setuptools and pip cannot be updated, you might be offline")
+ }
}
if (reqs_path==null) {
def args = ""
diff --git a/src/com/mirantis/mk/Salt.groovy b/src/com/mirantis/mk/Salt.groovy
index 1fc55e9..a35598e 100644
--- a/src/com/mirantis/mk/Salt.groovy
+++ b/src/com/mirantis/mk/Salt.groovy
@@ -666,6 +666,7 @@
def offlineDeployment = env.getEnvironment().containsKey("OFFLINE_DEPLOYMENT") && env["OFFLINE_DEPLOYMENT"].toBoolean()
try {
+ //TODO: remove wget after global env prop enforcments
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")