Properly decode output of create and destroy
This commit is contained in:
parent
942d629d6e
commit
7448cd90da
@ -137,6 +137,7 @@ class ShellScriptVirtualization(VirtualizationInterface):
|
||||
|
||||
self.validate_completed_process(completedProcess, email)
|
||||
lines = completedProcess.stdout.splitlines()
|
||||
status = lines[len(lines)-1].decode("utf-8")
|
||||
|
||||
vmSettings = f"""
|
||||
id={id}
|
||||
@ -146,7 +147,7 @@ class ShellScriptVirtualization(VirtualizationInterface):
|
||||
ssh_public_keys={ssh_keys_string}
|
||||
"""
|
||||
|
||||
if not lines[len(lines)-1] == "success":
|
||||
if not status == "success":
|
||||
raise ValueError(f"""failed to create vm for {email} with:
|
||||
{vmSettings}
|
||||
stdout:
|
||||
@ -160,8 +161,9 @@ class ShellScriptVirtualization(VirtualizationInterface):
|
||||
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")
|
||||
|
||||
if not lines[len(lines)-1] == "success":
|
||||
if not status == "success":
|
||||
raise ValueError(f"""failed to destroy vm "{id}" for {email}:
|
||||
stdout:
|
||||
{completedProcess.stdout}
|
||||
|
Loading…
Reference in New Issue
Block a user