Distinguish kept jobs and unmanaged jobs when skipping removal

Distinguish between ignoring kept managed jobs and unmanaged jobs when
deleting old jobs from the master.

Change-Id: I41e809a775ec9d07863b7c532c98f2eac4c8e5bf
This commit is contained in:
Darragh Bailey 2015-09-21 15:36:10 +01:00
parent b8eb60239f
commit 647bbdb7fc

@ -257,15 +257,17 @@ class Builder(object):
if keep is None:
keep = [job.name for job in self.parser.xml_jobs]
for job in jobs:
if job['name'] not in keep and \
self.jenkins.is_managed(job['name']):
logger.info("Removing obsolete jenkins job {0}"
.format(job['name']))
self.delete_job(job['name'])
deleted_jobs += 1
if job['name'] not in keep:
if self.jenkins.is_managed(job['name']):
logger.info("Removing obsolete jenkins job {0}"
.format(job['name']))
self.delete_job(job['name'])
deleted_jobs += 1
else:
logger.info("Not deleting unmanaged jenkins job %s",
job['name'])
else:
logger.debug("Ignoring unmanaged jenkins job %s",
job['name'])
logger.debug("Keeping job %s", job['name'])
return deleted_jobs
def delete_job(self, jobs_glob, fn=None):