v11.0.1: Minor bug fixes
ci/woodpecker/push/woodpecker Pipeline failed Details
ci/woodpecker/tag/woodpecker Pipeline failed Details

This commit is contained in:
Administrator 2024-02-29 04:31:06 +00:00
parent c28e8b45fc
commit 6bc5791980
3 changed files with 33 additions and 3 deletions

View File

@ -13,6 +13,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- 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]
## Changed

View File

@ -2,4 +2,4 @@
__all__ = ["api", "api_client", "client", "exceptions"]
__version__ = "11.0.0"
__version__ = "11.0.1"

View File

@ -199,6 +199,11 @@ def launch(
tries = 360
while tries > 0:
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 != "":
break
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())
candidates = []
for server in api_client.servers_launched_from_token(token=_token).servers:
if server.forgotten_at is not None:
continue
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(
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()
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)
from .api_client import APIClient