mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
Fixed issue with legacy jenkins instances
This commit is contained in:
@@ -191,7 +191,7 @@ class JenkinsJob:
|
|||||||
}
|
}
|
||||||
|
|
||||||
# This kind of jobs do not have a property that makes them enabled/disabled
|
# This kind of jobs do not have a property that makes them enabled/disabled
|
||||||
self.job_classes_exceptions = ["jenkins.branch.OrganizationFolder"]
|
self.job_classes_exceptions = ["jenkins.branch.OrganizationFolder","com.cloudbees.hudson.plugins.folder.Folder"]
|
||||||
|
|
||||||
self.EXCL_STATE = "excluded state"
|
self.EXCL_STATE = "excluded state"
|
||||||
|
|
||||||
@@ -208,13 +208,14 @@ class JenkinsJob:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.module.fail_json(msg='Unable to connect to Jenkins server, %s' % to_native(e), exception=traceback.format_exc())
|
self.module.fail_json(msg='Unable to connect to Jenkins server, %s' % to_native(e), exception=traceback.format_exc())
|
||||||
|
|
||||||
def job_class_excluded(self, response):
|
def job_class_excluded(self, check_class):
|
||||||
return response['_class'] in self.job_classes_exceptions
|
return check_class in self.job_classes_exceptions
|
||||||
|
|
||||||
def get_job_status(self):
|
def get_job_status(self):
|
||||||
try:
|
try:
|
||||||
|
check_class = ET.fromstring(self.get_current_config()).tag
|
||||||
response = self.server.get_job_info(self.name)
|
response = self.server.get_job_info(self.name)
|
||||||
if self.job_class_excluded(response):
|
if self.job_class_excluded(check_class):
|
||||||
return self.EXCL_STATE
|
return self.EXCL_STATE
|
||||||
else:
|
else:
|
||||||
return response['color'].encode('utf-8')
|
return response['color'].encode('utf-8')
|
||||||
|
|||||||
Reference in New Issue
Block a user