标签:
def check_jobs_from_jenkins(job_names): if isinstance(job_names, str): job_names = [job_names] job_dict = {} for job_name in job_names: job_dict[job_name] = True if is_job_exists(job_name) else False return job_dict def get_jenkins(): return jenkins.Jenkins(get_ci_url(), get_ci_user(), get_ci_password()) def is_job_exists(job_name): j = get_jenkins() try: j.assert_job_exists(job_name) logging.info(‘----- is_job_exists::%s::True-----‘ % job_name) return True except jenkins.JenkinsException: logging.info(‘----- is_job_exists::%s::False-----‘ % job_name) return False finally: pass
标签:
原文地址:http://www.cnblogs.com/liangnote/p/4837573.html