Change in vdsm[master]: jobs: Fix job error format
nsoffer at redhat.com
nsoffer at redhat.com
Tue Dec 29 15:31:29 UTC 2015
Nir Soffer has uploaded a new change for review.
Change subject: jobs: Fix job error format
......................................................................
jobs: Fix job error format
The schema species that job's error (ErrorInfo) is a map with "code" and
"message" keys, but we returned an error response dict used for xmlrpc
response. Add GeneralException.info() method, and use it to return the
promised ErrorInfo.
Change-Id: I2fdc6db6ed7519e5860d34e3a602dbeecce9a998
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M lib/vdsm/jobs.py
M lib/vdsm/utils.py
M tests/jobsTests.py
3 files changed, 6 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/51145/1
diff --git a/lib/vdsm/jobs.py b/lib/vdsm/jobs.py
index 1f47e31..69c9513 100644
--- a/lib/vdsm/jobs.py
+++ b/lib/vdsm/jobs.py
@@ -102,7 +102,7 @@
ret['progress'] = self.progress
if self.error:
- ret['error'] = self.error.response()
+ ret['error'] = self.error.info()
return ret
diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index fd7db78..1c8f74c 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -98,8 +98,11 @@
def __str__(self):
return "%s: %s" % (self.message, repr(self.value))
+ def info(self):
+ return {'code': self.code, 'message': str(self)}
+
def response(self):
- return {'status': {'code': self.code, 'message': str(self)}}
+ return {'status': self.info()}
class ActionStopped(GeneralException):
diff --git a/tests/jobsTests.py b/tests/jobsTests.py
index 13d4a55..371e757 100644
--- a/tests/jobsTests.py
+++ b/tests/jobsTests.py
@@ -192,4 +192,4 @@
error = utils.GeneralException()
job._error = error
self.assertEqual(job.error, error)
- self.assertEqual(error.response(), job.info()['error'])
+ self.assertEqual(error.info(), job.info()['error'])
--
To view, visit https://gerrit.ovirt.org/51145
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2fdc6db6ed7519e5860d34e3a602dbeecce9a998
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>
More information about the vdsm-patches
mailing list