Fixed a bug that showed instances not associated with the slice
[sfa.git] / sfa / managers / aggregate_manager_eucalyptus.py
index a38a6e8..e62381a 100644 (file)
@@ -370,7 +370,10 @@ def get_rspec(api, xrn, origin_hrn):
                 instanceId.append(instance.instance_id)
 
             # Get the information about those instances using their ids.
-            reservations = conn.get_all_instances(instanceId)
+            if len(instanceId) > 0:
+                reservations = conn.get_all_instances(instanceId)
+            else:
+                reservations = []
             for reservation in reservations:
                 for instance in reservation.instances:
                     instances.append(instance)
@@ -396,6 +399,11 @@ def get_rspec(api, xrn, origin_hrn):
 
     rspec = EucaRSpecBuilder(cloud).toXML()
 
+    # Remove the instances records so next time they won't 
+    # show up.
+    if 'instances' in cloud:
+        del cloud['instances']
+
     return rspec
 
 """