Commit 01cdbd3e authored by mvdbeek's avatar mvdbeek
Browse files

Fix port_parse rsplit usage

parent 8acf0d16
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -223,6 +223,7 @@ def parse_port_text(port_text):
    >>> slurm_ports = parse_port_text("8888/tcp -> 0.0.0.0:32769")
    >>> slurm_ports[8888]['host']
    '0.0.0.0'
    >>> ports = parse_port_text("5432/tcp -> :::5432")
    """
    ports = None
    if port_text is not None:
@@ -231,7 +232,7 @@ def parse_port_text(port_text):
            if " -> " not in line:
                raise Exception("Cannot parse host and port from line [%s]" % line)
            tool, host = line.split(" -> ", 1)
            hostname, port = host.rsplit(':')
            hostname, port = host.rsplit(':', 1)
            if hostname == '::':
                # Skip unspecified IPv6 address, which is also specified as 0:0:0:0 in another line.
                # This is brittle of course, but so is parsing the container ports like this.