diff --git a/lib/ansible/modules/web_infrastructure/jenkins_job.py b/lib/ansible/modules/web_infrastructure/jenkins_job.py index 649ac734b8..325be38d8c 100644 --- a/lib/ansible/modules/web_infrastructure/jenkins_job.py +++ b/lib/ansible/modules/web_infrastructure/jenkins_job.py @@ -191,7 +191,7 @@ class JenkinsJob: } # 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" @@ -208,13 +208,14 @@ class JenkinsJob: except Exception as e: 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): - return response['_class'] in self.job_classes_exceptions + def job_class_excluded(self, check_class): + return check_class in self.job_classes_exceptions def get_job_status(self): try: + check_class = ET.fromstring(self.get_current_config()).tag 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 else: return response['color'].encode('utf-8')