mirror of
https://github.com/OVERLORD7F/SVMU.git
synced 2025-10-01 21:52:47 +03:00
@@ -1,5 +1,8 @@
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from cluster_api import *
|
||||
from data_pools_api import *
|
||||
from rich import print
|
||||
from rich.panel import Panel
|
||||
from rich.console import Console , Align
|
||||
@@ -55,7 +58,12 @@ def config_edit(config_relative_path):
|
||||
menu_choice=str(read_input)
|
||||
if menu_choice == "Y" or menu_choice == "y":
|
||||
base_url = input("Type SpaceVM Controller IP: ")
|
||||
while ping(base_url) != True:
|
||||
base_url = console.input("[bold red]No response.\nCheck and type SpaceVM Controller IP again: [/]")
|
||||
api_key = input("Type your API Key: ")
|
||||
while check_api_key(base_url, "jwt " + api_key) != 200:
|
||||
api_key = console.input("[bold red]Check and type SpaceVM Controller API Key again: [/]")
|
||||
data_pools(base_url,"jwt " + api_key)
|
||||
data_pool_uuid = input("Type Data Pool UUID you wish to use: ")
|
||||
lines = [base_url, api_key, data_pool_uuid]
|
||||
with open(config_relative_path, "w+") as file:
|
||||
@@ -74,4 +82,16 @@ def config_edit(config_relative_path):
|
||||
cls()
|
||||
|
||||
def cls():
|
||||
os.system('cls' if os.name=='nt' else 'clear')
|
||||
os.system('cls' if os.name=='nt' else 'clear')
|
||||
|
||||
def ping(base_url):
|
||||
DNULL = open(os.devnull, 'w')
|
||||
if os.name == 'nt':
|
||||
status = subprocess.call(["ping","-n","1",base_url],stdout = DNULL)
|
||||
else:
|
||||
status = subprocess.call(["ping","-c","1",base_url],stdout = DNULL)
|
||||
|
||||
if status == 0:
|
||||
return True
|
||||
else:
|
||||
return False
|
Reference in New Issue
Block a user