X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmethods%2Fget_registries.py;h=a2a65a5744d7bb51d3b6176fa09f04caddd8ceed;hb=06b330f0ee047bdb107e43e82b1d7356c876bc15;hp=ed46b5a0876fe20308194707e30866863a171330;hpb=8851b151e02c8649ecde3754f7d7825adb4d19ad;p=sfa.git diff --git a/sfa/methods/get_registries.py b/sfa/methods/get_registries.py index ed46b5a0..a2a65a57 100644 --- a/sfa/methods/get_registries.py +++ b/sfa/methods/get_registries.py @@ -1,8 +1,8 @@ ### $Id: get_slices.py 14387 2009-07-08 18:19:11Z faiyaza $ ### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/methods/get_registries.py $ - +from types import StringTypes from sfa.util.faults import * -from sfa.util.misc 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 @@ -13,7 +13,7 @@ class get_registries(Method): Get a list of connection information for all known registries. @param cred credential string specifying the rights of the caller - @param a Human readable name (hrn), or list of hrns or None + @param a Human readable name (hrn or urn), or list of names or None @return list of dictionaries with aggregate information. """ @@ -21,15 +21,16 @@ class get_registries(Method): accepts = [ Parameter(str, "Credential string"), - Mixed([Parameter(str, "Human readable name (hrn)")], - Parameter(str, "Human readable name (hrn)"), - Parameter(None, "hrn not specified")) + Mixed(Parameter(str, "Human readable name (hrn or urn)"), + Parameter(None, "hrn not specified")) ] returns = [Parameter(dict, "Registry interface information")] - def call(self, cred, hrn = None): - + def call(self, cred, xrn = None): + hrn, type = urn_to_hrn(xrn) self.api.auth.check(cred, 'list') - registries = Registries(self.api) - return registries.interfaces + registries = Registries(self.api).interfaces.values() + if hrn: + registries = [reg for reg in registries if reg['hrn'] == hrn] + return registries