def listkeys(self, user, namesonly=False): ''' Yield all key names stored in the keydir for the given user. joe@{1..2}.pub -> [('joe', 1, <data>), ('joe', 2, ..)] ''' for key in glob('%s/%s@*' % (self.keydir, user)): act_user, machine = splitkey(basename(key)) if act_user == user: yield act_user, machine, None if namesonly else open(key).read()
def listkeys(self, user, namesonly=False): ''' Yield all key names stored in gitolite for the given user. keydir/joe@{1..2}.pub -> [('joe', 1, <data>), ('joe', 2, ..)] ''' tree = self.gitadm.tree(self.keydir) for key in tree.traverse(): act_user, machine = splitkey(key.name) if act_user == user: yield act_user, machine, None if namesonly else key.data_stream.read()