Add first support to auto-open URLs

This commit is contained in:
Jérôme Petazzoni
2017-11-12 22:47:07 -08:00
parent 6d4894458a
commit d99dbd5878

View File

@@ -260,6 +260,13 @@ while i < len(actions):
# FIXME: we should factor out the "bash" method
wait_for_prompt()
check_exit_status()
elif method == "open":
# Cheap way to get node1's IP address
screen = capture_pane()
ipaddr = re.findall("^\[(.*)\]", screen, re.MULTILINE)[-1]
url = data.replace("/node1", "/{}".format(ipaddr))
# This should probably be adapted to run on different OS
subprocess.check_call(["open", url])
else:
logging.warning("Unknown method {}: {!r}".format(method, data))
i += 1