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 <corvus@inaugust.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
Manuel Desbonnet 2012-09-12 14:11:57 +01:00 committed by Jenkins
parent a760c88433
commit 70f83bf756
2 changed files with 6 additions and 3 deletions

View File

@ -19,7 +19,7 @@ def main():
help='Path to output XML') help='Path to output XML')
parser_test.add_argument('name', help='name of job', nargs='?') parser_test.add_argument('name', help='name of job', nargs='?')
parser_delete = subparser.add_parser('delete') 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('--conf', dest='conf', help='Configuration file')
parser.add_argument('-l', '--log_level', dest='log_level', default='info', parser.add_argument('-l', '--log_level', dest='log_level', default='info',
help="Log level (default '%default')") help="Log level (default '%default')")
@ -48,8 +48,9 @@ def main():
config.get('jenkins', 'password')) config.get('jenkins', 'password'))
if options.command == 'delete': if options.command == 'delete':
logger.info("Deleting job {0}".format(options.name)) for job in options.name:
builder.delete_job(options.name) logger.info("Deleting job {0}".format(job))
builder.delete_job(job)
elif options.command == 'update': elif options.command == 'update':
logger.info("Updating jobs in {0} ({1})".format(options.path, logger.info("Updating jobs in {0} ({1})".format(options.path,
options.name)) options.name))

View File

@ -248,6 +248,8 @@ class Builder(object):
def delete_job(self, name): def delete_job(self, name):
self.jenkins.delete_job(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): def update_job(self, fn, name=None, output_dir=None):
if os.path.isdir(fn): if os.path.isdir(fn):