Ejemplo n.º 1
0
    def GET(self):
        try:
            ssh_address = get_container_ssh_address(socket.gethostname())
        except Exception as e:
            return self.status_exception("Cannot inspect own container.", e)

        return self.status_ok({'ssh': ssh_address, 'path': HERMES_DIRECTORY})
Ejemplo n.º 2
0
    def GET(self):
        try:
            ssh_address = get_container_ssh_address(socket.gethostname())
        except Exception as e:
            return self.status_exception("Cannot inspect own container.", e)

        return self.status_ok({'ssh': ssh_address, 'path': HERMES_DIRECTORY})
Ejemplo n.º 3
0
    def GET(self):
        try:
            ssh_address = get_container_ssh_address(socket.gethostname())
        except Exception as e:
            return self.status_error("Cannot inspect own container. {exception_class} - {exception}".format(
                    exception_class=type(e).__name__, exception=str(e)))

        return self.status_ok({'ssh': ssh_address, 'path': HERMES_DIRECTORY})
Ejemplo n.º 4
0
    def GET(self):
        try:
            ssh_address = get_container_ssh_address(socket.gethostname())
        except Exception as e:
            return self.status_error(
                "Cannot inspect own container. {exception_class} - {exception}"
                .format(exception_class=type(e).__name__, exception=str(e)))

        return self.status_ok({'ssh': ssh_address, 'path': HERMES_DIRECTORY})
Ejemplo n.º 5
0
def _fetch_hermes_from_couriers(courier_addresses):
    my_ssh_address = get_container_ssh_address(socket.gethostname())
    for courier_address in courier_addresses:
        courier_url = 'http://{courier_address}/update_hermes'.format(**locals())
        try:
            payload = { 'ssh': my_ssh_address, 'path': HERMES_DIRECTORY }
            requests.post(courier_url, json.dumps(payload))
        except Exception as e:
            _print_err('Fetching all sources from courier {courier_address} failed: {e}'.format(**locals()))
Ejemplo n.º 6
0
def _fetch_hermes_from_couriers(courier_addresses):
    my_ssh_address = get_container_ssh_address(socket.gethostname())
    for courier_address in courier_addresses:
        courier_url = 'http://{courier_address}/update_hermes'.format(**locals())
        try:
            payload = {'ssh': my_ssh_address, 'path': HERMES_DIRECTORY}
            requests.post(courier_url, json.dumps(payload))
        except Exception as e:
            _print_err('Fetching all sources from courier {courier_address} failed: {e}'.format(**locals()))
Ejemplo n.º 7
0
    def GET(self):
        container_id, error = self.get_get_parameter('container_id')
        if error:
            return self.status_error(error)

        try:
            ssh_address = get_container_ssh_address(container_id)
        except Exception as e:
            return self.status_exception("Cannot inspect requested container.", e)

        return self.status_ok({'ssh': ssh_address})
Ejemplo n.º 8
0
    def on_get(self, req, resp):
        container_id, error = self.get_get_parameter(req, 'container_id')
        if error:
            return self.status_error(resp, error)

        try:
            ssh_address = get_container_ssh_address(container_id)
        except Exception as e:
            return self.status_exception(resp, "Cannot inspect requested container.", e)

        return self.status_ok(resp, {'ssh': ssh_address})
Ejemplo n.º 9
0
    def GET(self):
        container_id, error = self.get_get_parameter('container_id')
        if error:
            return self.status_error(error)

        try:
            ssh_address = get_container_ssh_address(container_id)
        except Exception as e:
            return self.status_error("Cannot inspect requested container. {exception_class} - {exception}".format(
                    exception_class=type(e).__name__, exception=str(e)))

        return self.status_ok({'ssh': ssh_address})
Ejemplo n.º 10
0
    def GET(self):
        container_id, error = self.get_get_parameter('container_id')
        if error:
            return self.status_error(error)

        try:
            ssh_address = get_container_ssh_address(container_id)
        except Exception as e:
            return self.status_exception("Cannot inspect requested container.",
                                         e)

        return self.status_ok({'ssh': ssh_address})
Ejemplo n.º 11
0
    def GET(self):
        container_id, error = self.get_get_parameter('container_id')
        if error:
            return self.status_error(error)

        try:
            ssh_address = get_container_ssh_address(container_id)
        except Exception as e:
            return self.status_error(
                "Cannot inspect requested container. {exception_class} - {exception}"
                .format(exception_class=type(e).__name__, exception=str(e)))

        return self.status_ok({'ssh': ssh_address})
Ejemplo n.º 12
0
def _fetch_hermes_from_couriers(courier_addresses):
    my_ssh_address = get_container_ssh_address(socket.gethostname())
    for courier_address in courier_addresses:
        courier_url = 'http://{courier_address}/update_hermes'.format(**locals())
        try:
            payload = {'ssh': my_ssh_address, 'path': HERMES_DIRECTORY}
            response = requests.post(courier_url, json.dumps(payload))
            response.raise_for_status()
            if response.text.strip() != 'ok':
                raise Exception('Error response from courier:\n{}'.format(response.text))
        except Exception as e:
            get_logger().error('Fetching all sources from courier %s failed:', courier_address)
            get_logger().exception(e)
Ejemplo n.º 13
0
def _fetch_hermes_from_couriers(courier_addresses):
    my_ssh_address = get_container_ssh_address(socket.gethostname())
    for courier_address in courier_addresses:
        courier_url = 'http://{courier_address}/update_hermes'.format(**locals())
        try:
            payload = {'ssh': my_ssh_address, 'path': HERMES_DIRECTORY}
            response = requests.post(courier_url, json.dumps(payload))
            response.raise_for_status()
            if response.text.strip() != 'ok':
                raise Exception('Error response from courier:\n{}'.format(response.text))
        except Exception as e:
            get_logger().error('Fetching all sources from courier %s failed:', courier_address)
            get_logger().exception(e)