From f52070c4a671ad6ec3585a1f224d82f971407881 Mon Sep 17 00:00:00 2001 From: Jeremy Freudberg Date: Mon, 9 Jul 2018 12:11:00 -0400 Subject: [PATCH] Reflect response fixes for jobs/jobs templates In the experimental APIv2, some inconsistencies were recently fixed. Reflect that. Depends-On: https://review.openstack.org/581072 Change-Id: I408a0ab5ee1647307bb63635b2d7839c24be73d0 --- .../notes/job-job-template-apiv2-change-93ffbf2b1360cddc.yaml | 4 ++++ saharaclient/api/v2/job_templates.py | 4 ++-- saharaclient/api/v2/jobs.py | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/job-job-template-apiv2-change-93ffbf2b1360cddc.yaml diff --git a/releasenotes/notes/job-job-template-apiv2-change-93ffbf2b1360cddc.yaml b/releasenotes/notes/job-job-template-apiv2-change-93ffbf2b1360cddc.yaml new file mode 100644 index 00000000..76d89ca4 --- /dev/null +++ b/releasenotes/notes/job-job-template-apiv2-change-93ffbf2b1360cddc.yaml @@ -0,0 +1,4 @@ +other: + - When using APIv2, the viewing (GET) of specific job templates and jobs and + the creation (POST) of job templates and jobs now only supports the API + behavior of Sahara 9.0.0.0b3 or later. diff --git a/saharaclient/api/v2/job_templates.py b/saharaclient/api/v2/job_templates.py index 02368298..3fb2be0f 100644 --- a/saharaclient/api/v2/job_templates.py +++ b/saharaclient/api/v2/job_templates.py @@ -36,7 +36,7 @@ class JobTemplatesManagerV2(base.ResourceManager): libs=libs, interface=interface, is_public=is_public, is_protected=is_protected) - return self._create('/%s' % 'job-templates', data, 'job') + return self._create('/%s' % 'job-templates', data, 'job_template') def list(self, search_opts=None, limit=None, marker=None, sort_by=None, reverse=None): @@ -49,7 +49,7 @@ class JobTemplatesManagerV2(base.ResourceManager): def get(self, job_id): """Get information about a Job Template.""" - return self._get('/%s/%s' % ('job-templates', job_id), 'job') + return self._get('/%s/%s' % ('job-templates', job_id), 'job_template') def get_configs(self, job_type): """Get config hints for a specified Job Template type.""" diff --git a/saharaclient/api/v2/jobs.py b/saharaclient/api/v2/jobs.py index fa50894f..63ed701f 100644 --- a/saharaclient/api/v2/jobs.py +++ b/saharaclient/api/v2/jobs.py @@ -34,7 +34,7 @@ class JobsManagerV2(base.ResourceManager): def get(self, obj_id): """Get information about a Job.""" - return self._get('/jobs/%s' % obj_id, 'job_execution') + return self._get('/jobs/%s' % obj_id, 'job') def delete(self, obj_id): """Delete a Job.""" @@ -54,7 +54,7 @@ class JobsManagerV2(base.ResourceManager): job_configs=configs, interface=interface, is_public=is_public, is_protected=is_protected) - return self._create('/jobs', data, 'job_execution') + return self._create('/jobs', data, 'job') def refresh_status(self, obj_id): """Refresh Job Status."""