From 85a7cdd7a6d10a007cd8295888ca886c8f9bcd2e Mon Sep 17 00:00:00 2001 From: Memo Garcia <sirmemogarcia@gmail.com> Date: Tue, 7 Mar 2017 10:31:34 +0000 Subject: [PATCH] client-id is now required when creating jobs Change-Id: I6598ac3a14935c9b00efa4315b74b95d73781999 --- .vscode/settings.json | 3 +++ freezerclient/v1/jobs.py | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..20af2f6 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +// Place your settings in this file to overwrite default and user settings. +{ +} \ No newline at end of file diff --git a/freezerclient/v1/jobs.py b/freezerclient/v1/jobs.py index 28a9fbb..2a3c49d 100644 --- a/freezerclient/v1/jobs.py +++ b/freezerclient/v1/jobs.py @@ -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))