diff options
author | fengyuanxing <feng.yuanxing@zte.com.cn> | 2018-01-25 10:54:02 +0800 |
---|---|---|
committer | fengyuanxing <feng.yuanxing@zte.com.cn> | 2018-01-25 10:54:02 +0800 |
commit | a051c26a2abfec55a271eb6d661accb0ee36eb6c (patch) | |
tree | a7241c12c3e57ac00aca9ca32de0387e56722430 | |
parent | 3f537fa5c295cd7a03ff1115930cef7aa37e49ec (diff) |
Add status code for job views
Change-Id: Id7e1826dd1f33b4235896671960f6142cc4ffea7
Issue-ID: VFC-684
Signed-off-by: fengyuanxing <feng.yuanxing@zte.com.cn>
-rw-r--r-- | catalog/jobs/views.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/catalog/jobs/views.py b/catalog/jobs/views.py index a46d75af..16ade90c 100644 --- a/catalog/jobs/views.py +++ b/catalog/jobs/views.py @@ -40,7 +40,7 @@ class JobView(APIView): def get(self, request, job_id): response_id = ignore_case_get(request.META, 'responseId') ret = GetJobInfoService(job_id, response_id).do_biz() - return Response(data=ret) + return Response(data=ret, status=status.HTTP_200_OK) @swagger_auto_schema( operation_description="Update job status", @@ -61,8 +61,8 @@ class JobView(APIView): errcode = '0' if request.data.get('errcode') in ('true', 'active') else '255' logger.debug("errcode=%s", errcode) JobUtil.add_job_status(job_id, progress, desc, error_code=errcode) - return Response(data={'result': 'ok'}) + return Response(data={'result': 'ok'}, status=status.HTTP_202_ACCEPTED) except Exception as e: logger.error(e.message) logger.error(traceback.format_exc()) - return Response(data={'result': 'error', 'msg': e.message}) + return Response(data={'result': 'error', 'msg': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) |