From a0864e413aa45b0a1152d514645d9ac44c496968 Mon Sep 17 00:00:00 2001 From: SporeStack Date: Fri, 14 Apr 2023 21:57:08 +0000 Subject: [PATCH] v10.1.1: Fixed `sporestack server operating-systems` --- CHANGELOG.md | 21 +++++++++++++++++++++ integration-test.sh | 4 ++++ src/sporestack/__init__.py | 2 +- src/sporestack/api.py | 4 ++-- src/sporestack/cli.py | 4 +--- src/sporestack/models.py | 12 ++++++++++++ 6 files changed, 41 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65411f0..59c7129 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,29 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Deprecated features that will be removed in the next major version. + +- `burn_rate` from `TokenInfo` is deprecated. Use `burn_rate_cents` or `burn_rate_usd` instead. + ## [Unreleased] +- Nothing yet. + +## [10.2.0 - 2023-04-14] + +## Added + +- `burn_rate_cents` to `TokenInfo` to replace `burn_rate`. +- `burn_rate_usd` to `TokenInfo`. + +## Changed + +- `sporestack token info` will now show burn rate in dollar amount ($0.00) instead of cents. + +## Fixed + +- `sporestack server operating-systems` was updated to the new API behavior. (Unfortunately, was a breaking change.) + ## [10.1.0 - 2023-04-14] ## Added diff --git a/integration-test.sh b/integration-test.sh index 7d43d17..cb796ca 100755 --- a/integration-test.sh +++ b/integration-test.sh @@ -47,10 +47,14 @@ sporestack token info realtestingtoken sporestack token messages realtestingtoken sporestack token servers realtestingtoken +sporestack server list --token realtestingtoken sporestack server launch --no-quote --token realtestingtoken --operating-system debian-11 --days 1 --hostname sporestackpythonintegrationtestdelme +sporestack server list --token realtestingtoken | grep sporestackpythonintegrationtestdelme sporestack server topup --token realtestingtoken --hostname sporestackpythonintegrationtestdelme --days 1 sporestack server info --token realtestingtoken --hostname sporestackpythonintegrationtestdelme sporestack server json --token realtestingtoken --hostname sporestackpythonintegrationtestdelme +sporestack server autorenew-enable --token realtestingtoken --hostname sporestackpythonintegrationtestdelme +sporestack server autorenew-disable --token realtestingtoken --hostname sporestackpythonintegrationtestdelme sporestack server start --token realtestingtoken --hostname sporestackpythonintegrationtestdelme sporestack server stop --token realtestingtoken --hostname sporestackpythonintegrationtestdelme sporestack server rebuild --token realtestingtoken --hostname sporestackpythonintegrationtestdelme diff --git a/src/sporestack/__init__.py b/src/sporestack/__init__.py index 4ffc4ef..cd1b538 100644 --- a/src/sporestack/__init__.py +++ b/src/sporestack/__init__.py @@ -2,4 +2,4 @@ __all__ = ["api", "api_client", "exceptions"] -__version__ = "10.1.0" +__version__ = "10.1.1" diff --git a/src/sporestack/api.py b/src/sporestack/api.py index 2d75ac9..9b201aa 100644 --- a/src/sporestack/api.py +++ b/src/sporestack/api.py @@ -11,7 +11,7 @@ from typing import Dict, List, Optional, Union from pydantic import BaseModel, Field -from .models import Flavor, Payment +from .models import Flavor, OperatingSystem, Payment class TokenAdd: @@ -170,7 +170,7 @@ class OperatingSystems: method = "GET" class Response(BaseModel): - operating_systems: List[str] + operating_systems: Dict[str, OperatingSystem] class TokenMessageSender(str, Enum): diff --git a/src/sporestack/cli.py b/src/sporestack/cli.py index 8b360a2..db4e998 100644 --- a/src/sporestack/cli.py +++ b/src/sporestack/cli.py @@ -735,9 +735,7 @@ def token_info(token: str = typer.Argument(DEFAULT_TOKEN)) -> None: info = client.token.info() typer.echo(f"Balance: {info.balance_usd} ({info.balance_cents} cents)") typer.echo(f"Total servers: {info.servers}") - typer.echo( - f"Burn rate: {info.burn_rate} cents per day (of servers set to autorenew)" - ) + typer.echo(f"Burn rate: {info.burn_rate_usd} per day (of servers set to autorenew)") typer.echo( f"Days remaining: {info.days_remaining} (for servers set to autorenew, " "given the remaining balance)" diff --git a/src/sporestack/models.py b/src/sporestack/models.py index c292843..61a6fa8 100644 --- a/src/sporestack/models.py +++ b/src/sporestack/models.py @@ -41,9 +41,21 @@ class Flavor(BaseModel): bandwidth: int +class OperatingSystem(BaseModel): + slug: str + """Unique string to identify the operating system.""" + minimum_disk: int + """Minimum disk storage required in GiB""" + provider_slug: str + """Unique string to identify the operating system.""" + + class TokenInfo(BaseModel): balance_cents: int balance_usd: str burn_rate: int + """Deprecated.""" + burn_rate_cents: int + burn_rate_usd: str days_remaining: int servers: int