Merge "client-id is now required when creating jobs"

This commit is contained in:
Jenkins
2017-03-08 10:16:23 +00:00
committed by Gerrit Code Review
2 changed files with 17 additions and 4 deletions

3
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,3 @@
// Place your settings in this file to overwrite default and user settings.
{
}

View File

@@ -187,14 +187,24 @@ class JobCreate(command.Command):
"""Create a new job from a file"""
def get_parser(self, prog_name):
parser = super(JobCreate, self).get_parser(prog_name)
parser.add_argument('--file',
dest='file',
required=True,
help='Path to json file with the job')
parser.add_argument(
'--file',
dest='file',
required=True,
help='Path to json file with the job')
parser.add_argument(
'--client', '-C',
dest='client_id',
required=True,
help='Select a client for this job',
)
return parser
def take_action(self, parsed_args):
job = utils.doc_from_json_file(parsed_args.file)
job['client_id'] = parsed_args.client_id
job_id = self.app.client.jobs.create(job)
logging.info('Job {0} created'.format(job_id))