diff --git a/novaclient/base.py b/novaclient/base.py index 3bf61856b..40e100a9d 100644 --- a/novaclient/base.py +++ b/novaclient/base.py @@ -41,10 +41,7 @@ def getid(obj): Abstracts the common pattern of allowing both an object or an object's ID as a parameter when dealing with relationships. """ - try: - return obj.id - except AttributeError: - return obj + return getattr(obj, 'id', obj) # TODO(aababilov): call run_hooks() in HookableMixin's child classes