Simplify delete by removing unnecessary loop

Change-Id: Ic0d2ee0863c012bba22599e7be94718033c4aa97
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
This commit is contained in:
Thanh Ha 2016-08-19 11:41:31 -04:00 committed by Darragh Bailey
parent b62e2ea0b6
commit e47098d89d

View File

@ -41,16 +41,14 @@ class DeleteSubCommand(base.BaseSubCommand):
builder = JenkinsManager(jjb_config)
fn = options.path
registry = ModuleRegistry(jjb_config, builder.plugins_list)
for jobs_glob in options.name:
parser = YamlParser(jjb_config)
parser = YamlParser(jjb_config)
if fn:
parser.load_files(fn)
parser.expandYaml(registry, [jobs_glob])
jobs = [j['name'] for j in parser.jobs]
else:
jobs = [jobs_glob]
if fn:
parser.load_files(fn)
parser.expandYaml(registry, options.name)
jobs = [j['name'] for j in parser.jobs]
else:
jobs = options.name
builder.delete_jobs(jobs)
builder.delete_jobs(jobs)