client-id is now required when creating jobs

Change-Id: I6598ac3a14935c9b00efa4315b74b95d73781999
This commit is contained in:
Memo Garcia 2017-03-07 10:31:34 +00:00
parent 5e88395416
commit 85a7cdd7a6
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

@ -185,14 +185,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))