(self, by_container=True)
return indexed_portmap
List of TCP/IP ports mapped indexed by container port
List of TCP/IP ports mapped indexed by container port
List of TCP / IP ports mapped indexed by container port
def _get_portsmap(self, by_container=True):
        """List of TCP/IP ports mapped indexed by container port"""
        indexed_portmap = dict()
        for portmap in self.opt["portsmap"]:
            pmap = portmap.split(":")
            try:
                host_port = int(pmap[0])
                cont_port = int(pmap[1])
            except (ValueError, TypeError):
                try:
                    host_port = int(pmap[1])
                    cont_port = int(pmap[2])
                except (ValueError, TypeError):
                    host_port = None
                    cont_port = None
            if host_port:
                if by_container:
                    indexed_portmap[cont_port] = host_port
                else:
                    indexed_portmap[host_port] = cont_port
        return indexed_portmap
def _get_portsmap ( self , by_container = True ) : indexed_portmap = dict ( ) for portmap in self . opt [ "portsmap" ] : pmap = portmap . split ( ":" ) try : host_port = int ( pmap [ 0 ] ) cont_port = int ( pmap [ 1 ] ) except ( ValueError , TypeError ) : try : host_port = int ( pmap [ 1 ] ) cont_port = int ( pmap [ 2 ] ) except ( ValueError , TypeError ) : host_port = None cont_port = None if host_port : if by_container : indexed_portmap [ cont_port ] = host_port else : indexed_portmap [ host_port ] = cont_port return indexed_portmap