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