fix potential KeyError
[sfa.git] / sfa / planetlab / plaggregate.py
index c07d9c8..ef1a5bb 100644 (file)
@@ -191,7 +191,7 @@ class PlAggregate:
                 interface['client_id'] = "%s:%s" % (node['node_id'], if_id)
             rspec_node['interfaces'].append(interface)
             if_count+=1
-        tags = [PLTag(node_tags[tag_id]) for tag_id in node['node_tag_ids']]
+        tags = [PLTag(node_tags[tag_id]) for tag_id in node['node_tag_ids'] if tag_id in node_tags]
         rspec_node['tags'] = tags
         return rspec_node