v11.0.1: Minor bug fixes
This commit is contained in:
parent
c28e8b45fc
commit
6bc5791980
|
@ -13,6 +13,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
- Nothing yet.
|
- Nothing yet.
|
||||||
|
|
||||||
|
## [11.0.1 - 2024-02-29]
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
|
||||||
|
- If a server is deleted during the launch wait phase, it will give up rather than trying to wait forever for an IP address that will never come.
|
||||||
|
- `--hostname` matching is smarter in case of duplicate hostnames.
|
||||||
|
|
||||||
## [11.0.0 - 2024-02-26]
|
## [11.0.0 - 2024-02-26]
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
__all__ = ["api", "api_client", "client", "exceptions"]
|
__all__ = ["api", "api_client", "client", "exceptions"]
|
||||||
|
|
||||||
__version__ = "11.0.0"
|
__version__ = "11.0.1"
|
||||||
|
|
|
@ -199,6 +199,11 @@ def launch(
|
||||||
tries = 360
|
tries = 360
|
||||||
while tries > 0:
|
while tries > 0:
|
||||||
response = server.info()
|
response = server.info()
|
||||||
|
if response.deleted_at > 0:
|
||||||
|
typer.echo(
|
||||||
|
"Server creation failed, was deleted while waiting.", err=True
|
||||||
|
)
|
||||||
|
raise typer.Exit(code=1)
|
||||||
if response.ipv4 != "":
|
if response.ipv4 != "":
|
||||||
break
|
break
|
||||||
typer.echo("Waiting for server to build...", err=True)
|
typer.echo("Waiting for server to build...", err=True)
|
||||||
|
@ -523,11 +528,29 @@ def _get_machine_id(machine_id: str, hostname: str, token: str) -> str:
|
||||||
|
|
||||||
api_client = APIClient(api_endpoint=get_api_endpoint())
|
api_client = APIClient(api_endpoint=get_api_endpoint())
|
||||||
|
|
||||||
|
candidates = []
|
||||||
for server in api_client.servers_launched_from_token(token=_token).servers:
|
for server in api_client.servers_launched_from_token(token=_token).servers:
|
||||||
if server.forgotten_at is not None:
|
if server.forgotten_at is not None:
|
||||||
continue
|
continue
|
||||||
if server.hostname == hostname:
|
if server.hostname == hostname:
|
||||||
return server.machine_id
|
candidates.append(server)
|
||||||
|
|
||||||
|
if len(candidates) == 1:
|
||||||
|
return candidates[0].machine_id
|
||||||
|
|
||||||
|
remaining_candidates = []
|
||||||
|
for candidate in candidates:
|
||||||
|
if candidate.deleted_at == 0:
|
||||||
|
remaining_candidates.append(candidate)
|
||||||
|
|
||||||
|
if len(remaining_candidates) == 1:
|
||||||
|
return remaining_candidates[0].machine_id
|
||||||
|
elif len(remaining_candidates) > 1:
|
||||||
|
typer.echo(
|
||||||
|
"Too many servers match that hostname. Please use --machine-id, instead.",
|
||||||
|
err=True,
|
||||||
|
)
|
||||||
|
raise typer.Exit(code=1)
|
||||||
|
|
||||||
typer.echo(
|
typer.echo(
|
||||||
f"Could not find any servers matching the hostname: {hostname}", err=True
|
f"Could not find any servers matching the hostname: {hostname}", err=True
|
||||||
|
@ -970,7 +993,7 @@ def token_info(token: Annotated[str, typer.Argument()] = DEFAULT_TOKEN) -> None:
|
||||||
|
|
||||||
@token_cli.command()
|
@token_cli.command()
|
||||||
def servers(token: Annotated[str, typer.Argument()] = DEFAULT_TOKEN) -> None:
|
def servers(token: Annotated[str, typer.Argument()] = DEFAULT_TOKEN) -> None:
|
||||||
"""Returns server info for servers launched by a given token."""
|
"""Use sporestack server list --token TOKEN instead!"""
|
||||||
_token = load_token(token)
|
_token = load_token(token)
|
||||||
|
|
||||||
from .api_client import APIClient
|
from .api_client import APIClient
|
||||||
|
|
Loading…
Reference in New Issue