From 13e2d1319596147ab7c6554639bfc149824e217e Mon Sep 17 00:00:00 2001 From: Lingxian Kong Date: Tue, 1 Aug 2017 17:45:02 +1200 Subject: [PATCH] Fix getting update params Change-Id: I0724417cfe974c23813117cf3733de89f8f5f1c5 --- qinling/api/controllers/v1/function.py | 4 ++-- qinling/api/controllers/v1/job.py | 4 ++-- qinling/api/controllers/v1/runtime.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/qinling/api/controllers/v1/function.py b/qinling/api/controllers/v1/function.py index 698766bf..9eeaafbd 100644 --- a/qinling/api/controllers/v1/function.py +++ b/qinling/api/controllers/v1/function.py @@ -198,8 +198,8 @@ class FunctionsController(rest.RestController): """ values = {} for key in UPDATE_ALLOWED: - if key in func.to_dict(): - values.update({key: func.to_dict().get(key)}) + if func.to_dict().get(key) is not None: + values.update({key: func.to_dict()[key]}) LOG.info('Update resource, params: %s', values, resource={'type': self.type, 'id': id}) diff --git a/qinling/api/controllers/v1/job.py b/qinling/api/controllers/v1/job.py index 90c74bfc..821a9725 100644 --- a/qinling/api/controllers/v1/job.py +++ b/qinling/api/controllers/v1/job.py @@ -125,8 +125,8 @@ class JobsController(rest.RestController): """ values = {} for key in UPDATE_ALLOWED: - if key in job.to_dict(): - values.update({key: job.to_dict().get(key)}) + if job.to_dict().get(key) is not None: + values.update({key: job.to_dict()[key]}) LOG.info('Update resource, params: %s', values, resource={'type': self.type, 'id': id}) diff --git a/qinling/api/controllers/v1/runtime.py b/qinling/api/controllers/v1/runtime.py index 8ba9cb6b..e3a14510 100644 --- a/qinling/api/controllers/v1/runtime.py +++ b/qinling/api/controllers/v1/runtime.py @@ -113,8 +113,8 @@ class RuntimesController(rest.RestController): """ values = {} for key in UPDATE_ALLOWED: - if key in runtime.to_dict(): - values.update({key: runtime.to_dict().get(key)}) + if runtime.to_dict().get(key) is not None: + values.update({key: runtime.to_dict()[key]}) LOG.info('Update resource, params: %s', values, resource={'type': self.type, 'id': id})