[WiP] Added Cloud configuration check for proxy and setting up (if required)

This commit is contained in:
Quentin WEPHRE
2025-10-08 17:51:27 +02:00
parent 46a3c444dd
commit 49ce327722
6 changed files with 369 additions and 26 deletions

View File

@@ -54,12 +54,10 @@ def authenticate(base_url):
if not token:
raise requests.exceptions.RequestException
print("HTTPS ✅", end = " ", flush=True)
return token
except requests.exceptions.RequestException as e:
print(f"HTTPS ❌", flush=True)
if hasattr(e, 'response') and e.response:
raise Exception(e.response)
else:
@@ -82,13 +80,8 @@ def set_ssh_status(base_url, token):
try:
response = requests.post(ssh_url, headers=headers, json=payload, verify=False, timeout=10)
response.raise_for_status()
print(f"SSH ✅", end = " ", flush=True)
return True
except requests.exceptions.RequestException as e:
print("SSH ❌", flush=True)
if hasattr(e, 'response') and e.response:
raise Exception(e.response)
else:
@@ -111,8 +104,17 @@ def activate_ssh(ip_address):
if not verify_ssl:
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
token = authenticate(url)
if not token:
return
time.sleep(3)
set_ssh_status(url, token)
print(f"HTTPS", end=" ", flush=True)
try:
token = authenticate(url)
print(f"", end="", flush=True)
except Exception as e:
print(f"", flush=True)
raise
print(f"SSH", end=" ", flush=True)
try:
set_ssh_status(url, token)
print(f"", end="\n", flush=True)
except Exception as e:
print(f"", flush=True)
raise