Merge branch 'upstreammaster'
[sfa.git] / sfa / methods / get_aggregates.py
index 0ed15f3..23c8d60 100644 (file)
@@ -1,11 +1,6 @@
-### $Id: get_slices.py 14387 2009-07-08 18:19:11Z faiyaza $
-### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/methods/get_aggregates.py $
-from types import StringTypes
-from sfa.util.faults import *
-from sfa.util.namespace import *
+from sfa.util.xrn import urn_to_hrn
 from sfa.util.method import Method
 from sfa.util.parameter import Parameter, Mixed
-from sfa.trust.auth import Auth
 from sfa.server.aggregate import Aggregates
 
 class get_aggregates(Method):
@@ -30,5 +25,7 @@ class get_aggregates(Method):
     def call(self, cred, xrn = None):
         hrn, type = urn_to_hrn(xrn)
         self.api.auth.check(cred, 'list')
-        aggregates = Aggregates(self.api)
-        return aggregates.interfaces.values()
+        aggregates = Aggregates(self.api).interfaces.values()
+        if hrn:
+            aggregates = [agg for agg in aggregates if agg['hrn'] == hrn]
+        return aggregates