def _action(self, callable, url, **kwargs): try: return HttpResponse( callable(urljoin(self.server_http_url, url), **kwargs)) except requests.ConnectionError as e: check_nodes_status(config) raise e
def _action(self, callable, url, **kwargs): try: response = HttpResponse(callable(urljoin(self.server_http_url, url), **kwargs)) token = response.cookies.get("csrftoken") if token: self.session.headers["X-CSRFToken"] = token return response except requests.ConnectionError as e: check_nodes_status(config) raise e
def check_for_HYD_2849_4050(): # Debugging added for HYD-2849, must not impact normal exception handling check_nodes_status(config) # HYD-4050: spin here so that somebody can inspect if we hit this bug for command_id in command_ids: command = self.get_json_by_uri("/api/command/%s/" % command_id) for job_uri in command["jobs"]: job = self.get_json_by_uri(job_uri) job_steps = [self.get_json_by_uri(s) for s in job["steps"]] if job["errored"]: for step in job_steps: if step["state"] == "failed" and step["console"].find("is no initramfs") >= 0: return True return False