Francesco Romani has uploaded a new change for review. Change subject: lib: jsonrpc: add function to copy responses ......................................................................
lib: jsonrpc: add function to copy responses Sometimes we need to copy response values. This can be trivially made using utils.picklecopy, but an equally trivial helper function in the response module is nicer to read and more intent-revealing. Change-Id: I520cf2e90cad4635567a69c3fe94e3a011b3599f Signed-off-by: Francesco Romani <from...@redhat.com> --- M lib/vdsm/jsonrpcvdscli.py M lib/vdsm/response.py 2 files changed, 6 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/42971/1 diff --git a/lib/vdsm/jsonrpcvdscli.py b/lib/vdsm/jsonrpcvdscli.py index 8ef1cbf..de5d4d5 100644 --- a/lib/vdsm/jsonrpcvdscli.py +++ b/lib/vdsm/jsonrpcvdscli.py @@ -58,7 +58,7 @@ raise JsonRpcNoResponseError(method) if resp.error is not None: - return resp.error + return response.copy(resp.error) return response.success(**resp.result) diff --git a/lib/vdsm/response.py b/lib/vdsm/response.py index 758fde8..ee57bc4 100644 --- a/lib/vdsm/response.py +++ b/lib/vdsm/response.py @@ -22,6 +22,7 @@ from __future__ import absolute_import from vdsm.define import doneCode from vdsm.define import errCode +from vdsm.utils import picklecopy def success(message=None, **kwargs): @@ -40,3 +41,7 @@ "message": message or status["message"] } } + + +def copy(res): + return picklecopy(res) -- To view, visit https://gerrit.ovirt.org/42971 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I520cf2e90cad4635567a69c3fe94e3a011b3599f Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani <from...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches