Compare commits

..

No commits in common. "288ccd7357e3b0c0a38f16301c650c04c617e59a" and "9435a46fbd4d9894a69492284b8a28ff7afd08ab" have entirely different histories.

View File

@ -429,15 +429,12 @@ def dbs_create(passwd: str = typer.Option(..., help="DB password"),
@dbs_app.command("list") @dbs_app.command("list")
def dbs_list(raw: bool = typer.Option(False, help="Get result as raw json")): def dbs_list():
""" """
Show list of DBs: Show list of DBs:
ID, State, Name, IP, local IP, Password, Type ID, State, Name, IP, local IP, Password, Type
""" """
list_of_dbaas = Dbaas.list() list_of_dbaas = Dbaas.list()
if raw:
print(list_of_dbaas)
return
x = PrettyTable() x = PrettyTable()
x.field_names = ['id', 'state', 'name', 'ip', 'local_ip', 'password', 'type'] x.field_names = ['id', 'state', 'name', 'ip', 'local_ip', 'password', 'type']
if list_of_dbaas is None: if list_of_dbaas is None:
@ -512,27 +509,18 @@ def vds_goto(vds_id: Optional[int] = typer.Argument(None),
@servers_app.command("start") @servers_app.command("start")
def vds_start(vds_id: Optional[int] = typer.Argument(None), raw: bool = typer.Option(False, help="Get result as raw json")): def vds_start(vds_id: Optional[int] = typer.Argument(None)):
""" """
Start VDS Start VDS
""" """
if vds_id is None: if vds_id is None:
if raw:
print(
dict(
error="No VDS ID provided"
)
)
return 1
vds_list() vds_list()
vds_id = input("Enter VDS ID: ") vds_id = input("Enter VDS ID: ")
result = Server.start(vds_id) result = Server.start(vds_id)
if result is None: if result is None:
print(typer.style("Error", fg=typer.colors.RED)) print(typer.style("Error", fg=typer.colors.RED))
sys.exit(1) sys.exit(1)
if raw:
print(result)
return
for frame in cycle(r'-\|/'): for frame in cycle(r'-\|/'):
state = Server.get_vds(vds_id) state = Server.get_vds(vds_id)
if state: if state:
@ -544,26 +532,18 @@ def vds_start(vds_id: Optional[int] = typer.Argument(None), raw: bool = typer.Op
@servers_app.command("stop") @servers_app.command("stop")
def vds_stop(vds_id: Optional[int] = typer.Argument(None), raw: bool = typer.Option(False, help="Get result as raw json")): def vds_stop(vds_id: Optional[int] = typer.Argument(None)):
""" """
Stop VDS Stop VDS
""" """
if vds_id is None: if vds_id is None:
if raw:
print(
dict(
error="No VDS ID provided"
)
)
return 1
vds_list() vds_list()
vds_id = input("Enter VDS ID: ") vds_id = input("Enter VDS ID: ")
result = Server.stop(vds_id) result = Server.stop(vds_id)
if result is None: if result is None:
print(typer.style("Error", fg=typer.colors.RED)) print(typer.style("Error", fg=typer.colors.RED))
sys.exit(1) sys.exit(1)
if raw:
print(result)
for frame in cycle(r'-\|/'): for frame in cycle(r'-\|/'):
state = Server.get_vds(vds_id) state = Server.get_vds(vds_id)
if state: if state:
@ -581,13 +561,6 @@ def vds_clone(vds_id: Optional[int] = typer.Argument(None),
Clone VDS Clone VDS
""" """
if vds_id is None: if vds_id is None:
if raw:
print(
dict(
error="No VDS ID provided"
)
)
return 1
vds_list() vds_list()
vds_id = input("Enter VDS ID: ") vds_id = input("Enter VDS ID: ")
new_vds = Server.clone(vds_id) new_vds = Server.clone(vds_id)
@ -595,9 +568,6 @@ def vds_clone(vds_id: Optional[int] = typer.Argument(None),
print(typer.style("Error", fg=typer.colors.RED)) print(typer.style("Error", fg=typer.colors.RED))
sys.exit(1) sys.exit(1)
else: else:
if raw:
print(new_vds)
return
new_vds = new_vds['server'] new_vds = new_vds['server']
for frame in cycle(r'-\|/'): for frame in cycle(r'-\|/'):