summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-01-11 16:48:23 +0000
committerGerrit Code Review <review@openstack.org>2016-01-11 16:48:24 +0000
commit71449dbed9923f59677b9732719cf30eb6a8dfe0 (patch)
tree37c5ec62797a018711cea4e48368bf44b396a333
parentcae174f5f850073fa9b7daa41fff7d5c9ee33e28 (diff)
parent647bbdb7fcde2106151a02f3645fb7bea4540196 (diff)
downloadpython-jenkins-job-builder-71449dbed9923f59677b9732719cf30eb6a8dfe0.tar.gz
python-jenkins-job-builder-71449dbed9923f59677b9732719cf30eb6a8dfe0.tar.xz
python-jenkins-job-builder-71449dbed9923f59677b9732719cf30eb6a8dfe0.zip
Merge "Distinguish kept jobs and unmanaged jobs when skipping removal"
-rw-r--r--jenkins_jobs/builder.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/jenkins_jobs/builder.py b/jenkins_jobs/builder.py
index a6df6a0f..e377f610 100644
--- a/jenkins_jobs/builder.py
+++ b/jenkins_jobs/builder.py
@@ -283,15 +283,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):