5 from routes import Mapper
7 class PyHesiodFS(routefs.RouteFS):
8 controllers = ['getList', 'getReadme', 'getLocker']
9 def __init__(self, *args, **kwargs):
10 super(PyHesiodFS, self).__init__(*args, **kwargs)
11 self.fuse_args.add("allow_other", True)
17 m.connect('', controller='getList')
18 m.connect('README.txt', controller='getReadme')
19 m.connect(':action', controller='getLocker')
22 def getLocker(self, action, **kwargs):
23 if action in self.cache:
24 return routefs.Symlink(self.cache[action])
27 filsys = hesiod.FilsysLookup(action).filsys[0]
28 if filsys['type'] == 'AFS':
29 self.cache[action] = filsys['location']
30 return routefs.Symlink(self.cache[action])
31 except (TypeError, KeyError, IndexError):
34 def getList(self, **kwargs):
35 return self.cache.keys() + ['README.txt']
37 def getReadme(self, **kwargs):
39 This is the pyHesiodFS FUSE automounter. To access a Hesiod filsys,
40 just access /mit/name.
42 If you're using the Finder, try pressing Cmd+Shift+G and then entering
46 if __name__ == '__main__':
47 routefs.main(PyHesiodFS)