summaryrefslogtreecommitdiff
path: root/heat/objects
diff options
context:
space:
mode:
authorZane Bitter <zbitter@redhat.com>2016-12-05 14:58:20 -0500
committerZane Bitter <zbitter@redhat.com>2016-12-05 14:58:20 -0500
commitf310a1f6bc84e4c96e283b35514894065513b6f8 (patch)
tree8d64f35cf32d512bcaa7f87e4efc9ad01aa2cfcc /heat/objects
parent4078e228dd713e3b97b17b5c625bc2a710dd2eb0 (diff)
downloadheat-f310a1f6bc84e4c96e283b35514894065513b6f8.tar.gz
Handle ambiguous physical resource IDs
It's possible that we could end up with multiple resources with the same physical resource ID, but that would be undetectable since we return only one from the database layer. This change allows us to detect the problem an return an error where the result is rendered ambiguous. Change-Id: I2c5ddbe6731c33a09ec7c4a7b91dcfe414da4385
Diffstat (limited to 'heat/objects')
-rw-r--r--heat/objects/resource.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/heat/objects/resource.py b/heat/objects/resource.py
index 0c9b34b03..d49efbd8a 100644
--- a/heat/objects/resource.py
+++ b/heat/objects/resource.py
@@ -202,11 +202,12 @@ class Resource(
return cls._from_db_object(cls(context), context, resource_db)
@classmethod
- def get_by_physical_resource_id(cls, context, physical_resource_id):
- resource_db = db_api.resource_get_by_physical_resource_id(
+ def get_all_by_physical_resource_id(cls, context, physical_resource_id):
+ matches = db_api.resource_get_all_by_physical_resource_id(
context,
physical_resource_id)
- return cls._from_db_object(cls(context), context, resource_db)
+ return [cls._from_db_object(cls(context), context, resource_db)
+ for resource_db in matches]
@classmethod
def update_by_id(cls, context, resource_id, values):