Skip to content
Snippets Groups Projects
Commit 7c02ef4f authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

Removed deprecated conf download.

parent e6a654b5
No related branches found
No related tags found
No related merge requests found
...@@ -29,25 +29,12 @@ def setup(interactive=True): ...@@ -29,25 +29,12 @@ def setup(interactive=True):
req = requests.head(sk_url, verify=verify, timeout=20) req = requests.head(sk_url, verify=verify, timeout=20)
if req.status_code != 301: if req.status_code != 301:
raise Exception('Unexpected response from "%s": code %s, should have been 301.' % (sk_url, req.status_code)) raise Exception('Unexpected response from "%s": code %s, should have been 301.' % (sk_url, req.status_code))
# Check version of skyreach # Get conf using an activation key
req = requests.head(sk_url + '/erp/credentials/envsetup-conf.sh', verify=verify, timeout=20) act_key = utils.get_conf('SKYREACH_ACTIVATION_KEY')
use_activation_key = req.status_code == 403 if not act_key:
if use_activation_key: utils.log('\033[1;33m No activation key is set, skipping configuration download. \033[0m')
# Get conf using an activation key return
act_key = utils.get_conf('SKYREACH_ACTIVATION_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 not act_key:
utils.log('\033[1;33m No activation key is set, skipping configuration download. \033[0m')
return
req = requests.post(sk_url + '/erp/credentials/envsetup-conf.sh', data=dict(key=act_key, public_key=public_key), verify=verify, timeout=20)
else:
# Get conf using an api key
# (deprecated, for compatibility, to be removed when Panel version will be > 5.2)
utils.log('\033[1;33m Using deprecated way to get envsetup conf. \033[0m')
api_key = utils.get_conf('SKYREACH_API_KEY')
if not api_key:
utils.log('\033[1;33m No API key is set, skipping configuration download. \033[0m')
return
req = requests.get(sk_url + '/erp/credentials/' + api_key + '/conf.sh', verify=verify, timeout=20)
# Write conf # Write conf
if req.status_code != 200: if req.status_code != 200:
if len(req.text) > 300: if len(req.text) > 300:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment