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})
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})
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})
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})
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()))
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()))
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})
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})
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})
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})
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})
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)
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)