Ensure that the appended categories does in fact exist.

Closes #43
This commit is contained in:
Alvaro Lopez Garcia 2013-04-05 13:38:22 +02:00
parent 6d89bab5f8
commit b3f1fbbf79
1 changed files with 4 additions and 2 deletions

View File

@ -299,12 +299,14 @@ class OCCIRegistry(occi_registry.NonePersistentRegistry):
# 2. os and res templates
flavor_name = instance['instance_type'].name
res_tmp = self.get_category('/' + flavor_name + '/', extras)
entity.mixins.append(res_tmp)
if res_tmp:
entity.mixins.append(res_tmp)
os_id = instance['image_ref']
image_name = storage.get_image(os_id, context)['name']
os_tmp = self.get_category('/' + image_name + '/', extras)
entity.mixins.append(os_tmp)
if os_tmp:
entity.mixins.append(os_tmp)
# 3. network links & get links from cache!
net_links = net.get_network_details(identifier, context)