def update_rundeck_job_execution_enabled_status(self, rundeck_job_obj):
     """
     Update the execution_enabled flag for this RundeckJob object to reflect
     reality
     """
     url = "%s" % rundeck_job_obj.href
     headers = {
         "Accept": "application/xml",  # As of Rundeck 2.6.2, this endpoint
                                       # does not return json :(
         "X-Rundeck-Auth-Token": self.rundeck_token,
     }
     response = yield from http_get_request(url, headers, {})
     xml_root = etree.fromstring(response)
     execution_enabled = xml_root[0].find("executionEnabled").text
     rundeck_job_obj.execution_enabled = False
     if execution_enabled == "true":
         rundeck_job_obj.execution_enabled = True
Пример #2
0
    def retrieve_rundeck_job_info(self,
                                  rd_token,
                                  rd_baseurl,
                                  project_name,
                                  job_name):
        url = "%s/api/14/project/%s/jobs" % (rd_baseurl, project_name)
        headers = {
            "Accept": "application/json",
            "X-Rundeck-Auth-Token": rd_token,
        }
        params = {
            "jobExactFilter": job_name,
        }
        result = yield from http_get_request(url, headers, params)
        result = json.loads(result)

        if len(result) != 1:
            return False
        self.load(result[0])
        return True