Skip to content

Commit

Permalink
[schema] Return None if cannot locate resource
Browse files Browse the repository at this point in the history
When the schema locates a resource from database, it stores the
id/fq_name mapping in memory but in case the resource does not
exist, it tries to get id from a None value that results to
'AttributeError' exception.

Closes-bug: #1567267

Change-Id: If9387252b9da9093a939651fed8f7a5cbb09be04
  • Loading branch information
Édouard Thuleau committed Apr 7, 2016
1 parent f57b988 commit 9269e9a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/config/schema-transformer/config_db.py
Expand Up @@ -102,7 +102,7 @@ def reinit(cls):
@classmethod
def locate(cls, key, *args):
obj = super(DBBaseST, cls).locate(key, *args)
if obj.obj.uuid not in cls._uuid_fq_name_map:
if obj and obj.obj.uuid not in cls._uuid_fq_name_map:
cls._uuid_fq_name_map[obj.obj.uuid] = key
return obj
# end locate
Expand Down Expand Up @@ -370,7 +370,7 @@ def delete_inactive_service_chains(self, old_scs, new_scs=None):

# Delete the service chains that are no longer active
for remote_vn_name in old_scs:
# Get the Remote VNs in this VN's service chain and
# Get the Remote VNs in this VN's service chain and
# get a list of the remote service chains in the remote
# VNs which has this VNs name.
remote_vn = VirtualNetworkST.get(remote_vn_name)
Expand Down

0 comments on commit 9269e9a

Please sign in to comment.