Beispiel #1
0
    def _get_container_address(self):
        networks = docker_network_inspect(self.args, 'bridge')

        try:
            bridge = [network for network in networks if network['Name'] == 'bridge'][0]
            containers = bridge['Containers']
            container = [containers[container] for container in containers if containers[container]['Name'] == self.DOCKER_CONTAINER_NAME][0]
            return re.sub(r'/[0-9]+$', '', container['IPv4Address'])
        except Exception:
            display.error('Failed to process the following docker network inspect output:\n%s' %
                          json.dumps(networks, indent=4, sort_keys=True))
            raise
Beispiel #2
0
    def _get_simulator_address(self):
        networks = docker_network_inspect(self.args, 'bridge')

        try:
            bridge = [network for network in networks if network['Name'] == 'bridge'][0]
            containers = bridge['Containers']
            container = [containers[container] for container in containers if containers[container]['Name'] == self.DOCKER_SIMULATOR_NAME][0]
            return re.sub(r'/[0-9]+$', '', container['IPv4Address'])
        except:
            display.error('Failed to process the following docker network inspect output:\n%s' %
                          json.dumps(networks, indent=4, sort_keys=True))
            raise