summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
authorJustin Santa Barbara <justin@fathomdb.com>2011-03-14 14:17:58 -0700
committerJustin Santa Barbara <justin@fathomdb.com>2011-03-14 14:17:58 -0700
commitc94ec9a5bab6c07b402b68e2f4ff081247a27cda (patch)
tree437e4e1cbb128812af04a6aa9cb2ab50661bf89a /nova/utils.py
parent119bbe04f3c1de06a8c40502c314f13c89561564 (diff)
downloadnova-c94ec9a5bab6c07b402b68e2f4ff081247a27cda.tar.gz
nova-c94ec9a5bab6c07b402b68e2f4ff081247a27cda.tar.xz
nova-c94ec9a5bab6c07b402b68e2f4ff081247a27cda.zip
Initial implementation of refresh instance states
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/nova/utils.py b/nova/utils.py
index 87e726394..e93f489be 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -585,3 +585,12 @@ def get_from_path(items, path):
return results
else:
return get_from_path(results, remainder)
+
+
+def check_instance(obj, cls):
+ """Checks that obj is of type cls, and lets PyLint infer types"""
+ if isinstance(obj, cls):
+ return obj
+ raise Exception(_("Expected object of type: %s") % (str(cls)))
+ #TODO(justinsb): Can we make this better??
+ return cls() # Ugly PyLint hack