fleshing out spoke API

This commit is contained in:
2021-01-03 14:44:56 -06:00
parent 0a379b74ad
commit ad082eb0f9
3 changed files with 117 additions and 5 deletions

View File

@ -156,12 +156,18 @@ class ShellScriptSpoke(SpokeInterface):
{completedProcess.stderr}
""")
def destroy(self, email: str, id: str) -> str:
def destroy(self, email: str, id: str):
validate_capsul_id(id)
completedProcess = run([join(current_app.root_path, 'shell_scripts/destroy.sh'), id], capture_output=True)
self.validate_completed_process(completedProcess, email)
lines = completedProcess.stdout.splitlines()
status = lines[len(lines)-1].decode("utf-8")
return status
if not status == "success":
raise ValueError(f"""failed to destroy vm {id} for {email} on {current_app.config["SPOKE_HOST_ID"]}:
stdout:
{completedProcess.stdout}
stderr:
{completedProcess.stderr}
""")