From 70f83bf756e4fd993141de20b4633de68e13146f Mon Sep 17 00:00:00 2001 From: Manuel Desbonnet Date: Wed, 12 Sep 2012 14:11:57 +0100 Subject: [PATCH] Allow for deletion of mulitple jobs. Job deletion also clears the job cache, so that a subsequent update will upload even if the job hasn't changed. Change-Id: Ie6d756a469e9f0069532c1327da01d57fe4feffe Reviewed-on: https://review.openstack.org/13268 Reviewed-by: James E. Blair Reviewed-by: Clark Boylan Approved: James E. Blair Tested-by: Jenkins --- jenkins-jobs | 7 ++++--- jenkins_jobs/builder.py | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/jenkins-jobs b/jenkins-jobs index d3e8cbf47..8c81d1178 100755 --- a/jenkins-jobs +++ b/jenkins-jobs @@ -19,7 +19,7 @@ def main(): help='Path to output XML') parser_test.add_argument('name', help='name of job', nargs='?') parser_delete = subparser.add_parser('delete') - parser_delete.add_argument('name', help='name of job') + parser_delete.add_argument('name', help='name of job', nargs='+') parser.add_argument('--conf', dest='conf', help='Configuration file') parser.add_argument('-l', '--log_level', dest='log_level', default='info', help="Log level (default '%default')") @@ -48,8 +48,9 @@ def main(): config.get('jenkins', 'password')) if options.command == 'delete': - logger.info("Deleting job {0}".format(options.name)) - builder.delete_job(options.name) + for job in options.name: + logger.info("Deleting job {0}".format(job)) + builder.delete_job(job) elif options.command == 'update': logger.info("Updating jobs in {0} ({1})".format(options.path, options.name)) diff --git a/jenkins_jobs/builder.py b/jenkins_jobs/builder.py index 303b4efd5..77b0bab93 100644 --- a/jenkins_jobs/builder.py +++ b/jenkins_jobs/builder.py @@ -248,6 +248,8 @@ class Builder(object): def delete_job(self, name): self.jenkins.delete_job(name) + if(self.cache.is_cached(name)): + self.cache.set(name, '') def update_job(self, fn, name=None, output_dir=None): if os.path.isdir(fn):