Commit a1ececdc authored by mvdbeek's avatar mvdbeek
Browse files

Fix contianer port parsing if ::: in port line

:: is an unspecified ipv6 address and just recently appeared in the
docker port output.
parent 9169f6c8
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -230,8 +230,12 @@ def parse_port_text(port_text):
        for line in port_text.strip().split('\n'):
            if " -> " not in line:
                raise Exception("Cannot parse host and port from line [%s]" % line)
            if ':::' in line:
                # Skip unspecified ipv6 address.
                # This is brittle of course, but so is parsing the container ports like this.
                continue
            tool, host = line.split(" -> ", 1)
            hostname, port = host.split(':')
            hostname, port = host.rsplit(':')
            port = int(port)
            tool_p, tool_prot = tool.split("/")
            tool_p = int(tool_p)