Browse Source

2.0.2: Remove sporestack remove command (too confusing), cleanups, logging improvements

master 2.0.2
Teran McKinney 1 month ago
parent
commit
bea40b2958
  1. 4
      sporestack/api_client.py
  2. 12
      sporestack/client.py
  3. 2
      sporestack/version.py

4
sporestack/api_client.py

@ -68,7 +68,7 @@ def api_request(
)
except Exception as e:
if retry is True:
log.warning("Got an error, but retrying: {}".format(e))
log.warning(f"Got an error, but retrying: {e}")
sleep(5)
# Try again.
return api_request(
@ -94,7 +94,7 @@ def api_request(
if request.status_code == 415:
raise NotImplementedError(request.content.decode("utf-8"))
else:
log.debug("Status code: {}".format(request.status_code))
log.debug("Status code: {request.status_code}")
raise ValueError(request.content.decode("utf-8"))
elif status_code_first_digit == 5:
if retry is True:

12
sporestack/client.py

@ -90,7 +90,7 @@ def launch(
raise ValueError("--currency must be set.")
if machine_exists(hostname):
message = "{} already created.".format(hostname)
message = f"{hostname} already created."
raise ValueError(message)
with open(ssh_key) as fp:
@ -371,16 +371,6 @@ def remove(hostname: str) -> None:
machine_info_path().joinpath(f"{hostname}.json").unlink()
@cli.cmd(name="remove")
@cli.cmd_arg("hostname")
def remove_cli(hostname):
info = get_machine_info(hostname)
print(info)
print(pretty_machine_info(info))
remove(hostname)
print("{} removed.".format(hostname))
def machine_exists(hostname: str) -> bool:
"""
Check if the VM's JSON exists locally.

2
sporestack/version.py

@ -1 +1 @@
__version__ = "2.0.1"
__version__ = "2.0.2"
Loading…
Cancel
Save