Move 'delete' yaml parsing to JenkinsJobs.execute.

This is the final piece of YamlParser in jenkins_jobs.builder, so also
remove the imports and make trivial fixes to test methods to prevent
borked test cases.

Change-Id: Ida543fa14c70447ae506092ec8afd5cb6caaa629
This commit is contained in:
Wayne Warren
2016-01-01 23:24:38 -08:00
parent 3ce6618381
commit 7373201882
3 changed files with 19 additions and 16 deletions

View File

@@ -133,8 +133,21 @@ class JenkinsJobs(object):
builder = Builder(self.jjb_config)
if options.command == 'delete':
for job in options.name:
builder.delete_job(job, options.path)
parser = YamlParser(self.jjb_config, builder.plugins_list)
fn = options.path
for jobs_glob in options.name:
parser = YamlParser(self.jjb_config, builder.plugins_list)
if fn:
parser.load_files(fn)
parser.expandYaml([jobs_glob])
jobs = [j['name'] for j in parser.jobs]
else:
jobs = [jobs_glob]
builder.delete_job(jobs)
elif options.command == 'delete-all':
if not utils.confirm(