5 from routes import Mapper
10 class PyHesiodFS(routefs.RouteFS):
11 controllers = ['getList', 'getReadme', 'getLocker']
12 def __init__(self, *args, **kwargs):
13 super(PyHesiodFS, self).__init__(*args, **kwargs)
14 self.fuse_args.add("allow_other", True)
20 m.connect('/', controller='getList')
21 m.connect('/README.txt', controller='getReadme')
22 m.connect('/{action}', controller='getLocker')
25 def getLocker(self, action, **kwargs):
26 if action in self.cache:
27 return routefs.Symlink(self.cache[action])
30 filsys = hesiod.FilsysLookup(action).filsys[0]
31 if filsys['type'] == 'AFS':
32 self.cache[action] = filsys['location']
33 return routefs.Symlink(self.cache[action])
34 except (TypeError, KeyError, IndexError):
37 def getList(self, **kwargs):
38 return self.cache.keys() + ['README.txt']
40 def getReadme(self, **kwargs):
42 This is the pyHesiodFS FUSE automounter. To access a Hesiod filsys,
43 just access /mit/name.
45 If you're using the Finder, try pressing Cmd+Shift+G and then entering
50 if __name__ == '__main__':
51 routefs.main(PyHesiodFS)