|
|
|
@ -192,9 +192,13 @@ def launch(
|
|
|
|
|
typer.echo("Server creation failed, tries exceeded.", err=True)
|
|
|
|
|
raise typer.Exit(code=1)
|
|
|
|
|
|
|
|
|
|
created_dict = response.dict()
|
|
|
|
|
typer.echo(pretty_machine_info(created_dict), err=True)
|
|
|
|
|
typer.echo(json.dumps(created_dict, indent=4))
|
|
|
|
|
typer.echo(
|
|
|
|
|
pretty_machine_info(
|
|
|
|
|
api_client.info(
|
|
|
|
|
machine_id=machine_id, api_endpoint=get_api_endpoint()
|
|
|
|
|
).dict()
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@server_cli.command()
|
|
|
|
@ -203,7 +207,6 @@ def topup(
|
|
|
|
|
machine_id: str = "",
|
|
|
|
|
days: int = typer.Option(...),
|
|
|
|
|
token: str = DEFAULT_TOKEN,
|
|
|
|
|
quote: bool = typer.Option(True, help="Require manual price confirmation."),
|
|
|
|
|
) -> None:
|
|
|
|
|
"""
|
|
|
|
|
Extend an existing SporeStack server's lifetime.
|
|
|
|
@ -213,19 +216,6 @@ def topup(
|
|
|
|
|
|
|
|
|
|
_token = load_token(token)
|
|
|
|
|
|
|
|
|
|
if quote:
|
|
|
|
|
response = api_client.topup(
|
|
|
|
|
machine_id=machine_id,
|
|
|
|
|
days=days,
|
|
|
|
|
api_endpoint=get_api_endpoint(),
|
|
|
|
|
token=_token,
|
|
|
|
|
retry=True,
|
|
|
|
|
quote=True,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
typer.echo(f"Is {response.payment.usd} for {days} day(s) okay?", err=True)
|
|
|
|
|
input("[Press ctrl+c to cancel, or enter to accept.]")
|
|
|
|
|
|
|
|
|
|
response = api_client.topup(
|
|
|
|
|
machine_id=machine_id,
|
|
|
|
|
days=days,
|
|
|
|
@ -290,10 +280,16 @@ def pretty_machine_info(info: Dict[str, Any]) -> str:
|
|
|
|
|
elif "hostname" in info:
|
|
|
|
|
msg += "Hostname: {}\n".format(info["hostname"])
|
|
|
|
|
|
|
|
|
|
if "ipv6" in info["network_interfaces"][0]:
|
|
|
|
|
msg += "IPv6: {}\n".format(info["network_interfaces"][0]["ipv6"])
|
|
|
|
|
if "ipv4" in info["network_interfaces"][0]:
|
|
|
|
|
msg += "IPv4: {}\n".format(info["network_interfaces"][0]["ipv4"])
|
|
|
|
|
if "network_interfaces" in info:
|
|
|
|
|
if "ipv6" in info["network_interfaces"][0]:
|
|
|
|
|
msg += "IPv6: {}\n".format(info["network_interfaces"][0]["ipv6"])
|
|
|
|
|
if "ipv4" in info["network_interfaces"][0]:
|
|
|
|
|
msg += "IPv4: {}\n".format(info["network_interfaces"][0]["ipv4"])
|
|
|
|
|
else:
|
|
|
|
|
if "ipv6" in info:
|
|
|
|
|
msg += "IPv6: {}\n".format(info["ipv6"])
|
|
|
|
|
if "ipv4" in info:
|
|
|
|
|
msg += "IPv4: {}\n".format(info["ipv4"])
|
|
|
|
|
expiration = info["expiration"]
|
|
|
|
|
human_expiration = time.strftime("%Y-%m-%d %H:%M:%S %z", time.localtime(expiration))
|
|
|
|
|
if "running" in info:
|
|
|
|
|