diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-12-08 08:15:53 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-12-08 08:15:53 +0000 |
| commit | 9062a31c0774b815213e02497b66e591f783795b (patch) | |
| tree | 29bf216f958c6c95441f3a17e784f7f9b3cb4001 | |
| parent | 5fb74870b5a93e370983eb65ecca1947775297b1 (diff) | |
| parent | 670dc3f8844e6fd3bcf9df1195891162a13719fe (diff) | |
| download | oslo-9062a31c0774b815213e02497b66e591f783795b.tar.gz oslo-9062a31c0774b815213e02497b66e591f783795b.tar.xz oslo-9062a31c0774b815213e02497b66e591f783795b.zip | |
Merge "Allow remote stdlib exceptions to be deserialized"
| -rw-r--r-- | openstack/common/rpc/__init__.py | 1 | ||||
| -rw-r--r-- | tests/unit/rpc/test_common.py | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/openstack/common/rpc/__init__.py b/openstack/common/rpc/__init__.py index f84c493..e11fa16 100644 --- a/openstack/common/rpc/__init__.py +++ b/openstack/common/rpc/__init__.py @@ -50,6 +50,7 @@ rpc_opts = [ default=['openstack.common.exception', 'nova.exception', 'cinder.exception', + 'exceptions', ], help='Modules of exceptions that are permitted to be recreated' 'upon receiving exception data from an rpc call.'), diff --git a/tests/unit/rpc/test_common.py b/tests/unit/rpc/test_common.py index 7489a8f..6f8b7ff 100644 --- a/tests/unit/rpc/test_common.py +++ b/tests/unit/rpc/test_common.py @@ -84,6 +84,20 @@ class RpcCommonTestCase(test_utils.BaseTestCase): def test_deserialize_remote_exception(self): failure = { + 'class': 'NotImplementedError', + 'module': 'exceptions', + 'message': '', + 'tb': ['raise NotImplementedError'], + } + serialized = jsonutils.dumps(failure) + + after_exc = rpc_common.deserialize_remote_exception(FLAGS, serialized) + self.assertTrue(isinstance(after_exc, NotImplementedError)) + #assure the traceback was added + self.assertTrue('raise NotImplementedError' in unicode(after_exc)) + + def test_deserialize_remote_custom_exception(self): + failure = { 'class': 'OpenstackException', 'module': 'openstack.common.exception', 'message': exception.OpenstackException.message, |
