diff options
author | Vishvananda Ishaya <vishvananda@gmail.com> | 2012-01-06 02:18:22 +0000 |
---|---|---|
committer | Vishvananda Ishaya <vishvananda@gmail.com> | 2012-01-06 02:24:06 +0000 |
commit | 613d1dbc87d9af5d07dc277f0264d6fe1e2e073b (patch) | |
tree | 5e1c81e7549f22649356663ca92491cb76d1dc82 /nova/utils.py | |
parent | dcf5fe4d9307c0d477fb8c48df74a812244d8b97 (diff) | |
download | nova-613d1dbc87d9af5d07dc277f0264d6fe1e2e073b.tar.gz nova-613d1dbc87d9af5d07dc277f0264d6fe1e2e073b.tar.xz nova-613d1dbc87d9af5d07dc277f0264d6fe1e2e073b.zip |
Adds workaround check for mox in to_primitive
* Works around bug 852095
* Can be removed if a consistent mox 5.4 is released
Change-Id: I3e57b60886a94c5e7a337b73716759c9a6838e04
Diffstat (limited to 'nova/utils.py')
-rw-r--r-- | nova/utils.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/nova/utils.py b/nova/utils.py index efefc5fd1..3d2f901a8 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -41,6 +41,7 @@ from eventlet import event from eventlet import greenthread from eventlet import semaphore from eventlet.green import subprocess +import mox import netaddr from nova import exception @@ -689,6 +690,12 @@ def to_primitive(value, convert_instances=False, level=0): if test(value): return unicode(value) + # NOTE(vish): Workaround for LP bug 852095. Without this workaround, + # tests that raise an exception in a mocked method that + # has a @wrap_exception with a notifier will fail. + if isinstance(value, mox.MockAnything): + return 'mock' + if level > 3: return '?' |