From e905a59c0c27d06c1d6cbbcfe4b304aebd2f6238 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Diemer?= <stephane.diemer@ubicast.eu>
Date: Thu, 12 Sep 2019 08:33:47 +0200
Subject: [PATCH] Skip configuration download if SKYREACH_ACTIVATION_KEY is set
 to "no-dl"

---
 .../1.Download_envsetup_config/0_setup.py          | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/3.New_server_deployment/1.Download_envsetup_config/0_setup.py b/3.New_server_deployment/1.Download_envsetup_config/0_setup.py
index deec9951..34f444e0 100644
--- a/3.New_server_deployment/1.Download_envsetup_config/0_setup.py
+++ b/3.New_server_deployment/1.Download_envsetup_config/0_setup.py
@@ -32,14 +32,16 @@ def setup(interactive=True):
     if req.status_code != 301:
         raise Exception('Unexpected response from "%s": code %s, should have been 301.' % (sk_url, req.status_code))
     # Get conf using API key if already set or using an activation key
-    req = None
     api_key = utils.get_conf('SKYREACH_API_KEY')
-    if api_key:
+    act_key = utils.get_conf('SKYREACH_ACTIVATION_KEY')
+    req = None
+    if act_key == 'no-dl':
+        utils.log('\033[1;34m The activation key is set to "no-dl", skipping configuration download. \033[0m')
+        return
+    elif api_key:
         req = requests.post(sk_url + '/erp/credentials/envsetup-conf.sh', params=dict(api_key=api_key), data=dict(public_key=public_key), verify=verify, timeout=20)
-    else:
-        act_key = utils.get_conf('SKYREACH_ACTIVATION_KEY')
-        if act_key:
-            req = requests.post(sk_url + '/erp/credentials/envsetup-conf.sh', data=dict(key=act_key, public_key=public_key), verify=verify, timeout=20)
+    elif act_key:
+        req = requests.post(sk_url + '/erp/credentials/envsetup-conf.sh', data=dict(key=act_key, public_key=public_key), verify=verify, timeout=20)
     if req is None:
         utils.log('\033[1;33m No activation key nor API key are set, skipping configuration download. \033[0m')
         return
-- 
GitLab