Accept objects in name_or_id parameter

Let's not tell anybody about it, but if someone passes us an object
in the name_or_id slot, let's roll with it.

Change-Id: I70ea91c948c0f82185861baa22830a4954359b6f
This commit is contained in:
Monty Taylor 2015-11-28 10:55:01 -05:00 committed by David Shrewsbury
parent bd2f1cbc6f
commit 0d5e7b561e

View File

@ -125,6 +125,9 @@ def _get_entity(func, name_or_id, filters):
:param dict filters:
A dictionary of meta data to use for further filtering.
"""
# We've been passed a dict/object already, return it
if hasattr(name_or_id, 'id'):
return name_or_id
entities = func(name_or_id, filters)
if not entities:
return None