Decode bytes to string before comparing with regex
- Python3 makes this a lil more complicated - see https://stackoverflow.com/questions/21689365/python-3-typeerror-must-be-str-not-bytes-with-sys-stdout-write
This commit is contained in:
parent
60a8f34a9b
commit
942d629d6e
@ -96,11 +96,12 @@ class ShellScriptVirtualization(VirtualizationInterface):
|
||||
completedProcess = run([join(current_app.root_path, 'shell_scripts/get.sh'), id], capture_output=True)
|
||||
self.validate_completed_process(completedProcess)
|
||||
lines = completedProcess.stdout.splitlines()
|
||||
ipaddr = lines[0].decode("utf-8")
|
||||
|
||||
if not re.match(r"^([0-9]{1,3}\.){3}[0-9]{1,3}$", lines[0]):
|
||||
if not re.match(r"^([0-9]{1,3}\.){3}[0-9]{1,3}$", ipaddr):
|
||||
return None
|
||||
|
||||
return VirtualMachine(id, ipv4=lines[0])
|
||||
return VirtualMachine(id, ipv4=ipaddr)
|
||||
|
||||
def list_ids(self) -> list:
|
||||
completedProcess = run([join(current_app.root_path, 'shell_scripts/list-ids.sh')], capture_output=True)
|
||||
|
Loading…
Reference in New Issue
Block a user