Esempio n. 1
0
 def getClientBySockName(sockname):
     base = GitFSBase()
     base.socket_path = sockname
     info = base.getInfoRemote()
     if 'path' in info:
         return GitFSClient(info['path'], sockname)
     raise GitFSError(GitFSError.eNotGitFS, "Not a gitfs socket.")
Esempio n. 2
0
 def checkSocketName(sockname):
     base = GitFSBase()
     base.socket_path = sockname
     info = base.getInfoRemote()
     logging.debug('attempting getinfo for %s returned %s' %(sockname, info))
     if 'path' in info:
         return sockname
     raise GitFSError(GitFSError.eNotGitFS, "Not a gitfs socket.")
Esempio n. 3
0
 def applyToIdents(ident, func, cleanup_on_exception=True):
     r = []
     if '.' not in ident:
         ident = ident + '.*'
     base = GitFSBase()
     csp = base.getControlSocketPath(ident)
     logging.debug('trying %s for ident %s' %(csp, ident))
     f = iglob(csp)
     
     for sockname in f:
         try:
             r.append(func(sockname))
         except Exception as e:
             logging.debug('apply to Idents caught %s' %e)
             if cleanup_on_exception:
                 try:
                     os.remove(sockname)
                 except OSError:
                     pass
     return r
Esempio n. 4
0
 def getClientByID(ident):
     base = GitFSBase()
     base.lockGitFSDir()
     try:
         client = GitFSClient.getClientByIDNoLock(ident)
     finally:
         base.unlockGitFSDir()
     return client