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)
|
self.validate_completed_process(completedProcess, email)
|
||||||
lines = completedProcess.stdout.splitlines()
|
lines = completedProcess.stdout.splitlines()
|
||||||
|
status = lines[len(lines)-1].decode("utf-8")
|
||||||
|
|
||||||
vmSettings = f"""
|
vmSettings = f"""
|
||||||
id={id}
|
id={id}
|
||||||
@ -146,7 +147,7 @@ class ShellScriptVirtualization(VirtualizationInterface):
|
|||||||
ssh_public_keys={ssh_keys_string}
|
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:
|
raise ValueError(f"""failed to create vm for {email} with:
|
||||||
{vmSettings}
|
{vmSettings}
|
||||||
stdout:
|
stdout:
|
||||||
@ -160,8 +161,9 @@ class ShellScriptVirtualization(VirtualizationInterface):
|
|||||||
completedProcess = run([join(current_app.root_path, 'shell_scripts/destroy.sh'), id], capture_output=True)
|
completedProcess = run([join(current_app.root_path, 'shell_scripts/destroy.sh'), id], capture_output=True)
|
||||||
self.validate_completed_process(completedProcess, email)
|
self.validate_completed_process(completedProcess, email)
|
||||||
lines = completedProcess.stdout.splitlines()
|
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}:
|
raise ValueError(f"""failed to destroy vm "{id}" for {email}:
|
||||||
stdout:
|
stdout:
|
||||||
{completedProcess.stdout}
|
{completedProcess.stdout}
|
||||||
|
Loading…
Reference in New Issue
Block a user