X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=sfa%2Fclient%2Fsfaadmin.py;h=0cf9a41a06fe48670e8c24915911a43e36342abe;hb=290d76024e7dc7899ef8b53769f65cc2b0e19c26;hp=169bfedec3fe279ca91ea8ee950052157b264df0;hpb=af81f9e278ebfb25a7675629aa23c3b2cf7f79db;p=sfa.git diff --git a/sfa/client/sfaadmin.py b/sfa/client/sfaadmin.py index 169bfede..0cf9a41a 100755 --- a/sfa/client/sfaadmin.py +++ b/sfa/client/sfaadmin.py @@ -125,9 +125,8 @@ class RegistryCommands(Commands): """Check the correspondance between the GID and the PubKey""" # db records - from sfa.storage.alchemy import dbsession from sfa.storage.model import RegRecord - db_query = dbsession.query(RegRecord).filter_by(type=type) + db_query = self.api.dbsession().query(RegRecord).filter_by(type=type) if xrn and not all: hrn = Xrn(xrn).get_hrn() db_query = db_query.filter_by(hrn=hrn) @@ -260,7 +259,7 @@ Users having a GID/PubKey correpondence NOT OK: %s and are: \n%s\n\n"%(len(NOKEY """Initialize or upgrade the db""" from sfa.storage.dbschema import DBSchema dbschema=DBSchema() - dbschema.init_or_upgrade + dbschema.init_or_upgrade() @args('-a', '--all', dest='all', metavar='', action='store_true', default=False, help='Remove all registry records and all files in %s area' % help_basedir) @@ -306,6 +305,9 @@ Users having a GID/PubKey correpondence NOT OK: %s and are: \n%s\n\n"%(len(NOKEY class CertCommands(Commands): + + def __init__(self, *args, **kwds): + self.api= Generic.the_flavour().make_api(interface='registry') def import_gid(self, xrn): pass @@ -315,10 +317,9 @@ class CertCommands(Commands): @args('-o', '--outfile', dest='outfile', metavar='', help='output file', default=None) def export(self, xrn, type=None, outfile=None): """Fetch an object's GID from the Registry""" - from sfa.storage.alchemy import dbsession from sfa.storage.model import RegRecord hrn = Xrn(xrn).get_hrn() - request=dbsession.query(RegRecord).filter_by(hrn=hrn) + request=self.api.dbsession().query(RegRecord).filter_by(hrn=hrn) if type: request = request.filter_by(type=type) record=request.first() if record: