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)
18 m.connect('', controller='getList')
19 m.connect('README.txt', controller='getReadme')
20 m.connect(':action', controller='getLocker')
23 def getLocker(self, action, **kwargs):
24 if action in self.cache:
25 return routefs.Symlink(self.cache[action])
28 filsys = hesiod.FilsysLookup(action).filsys[0]
29 if filsys['type'] == 'AFS':
30 self.cache[action] = filsys['location']
31 return routefs.Symlink(self.cache[action])
32 except (TypeError, KeyError, IndexError):
35 def getList(self, **kwargs):
36 return self.cache.keys() + ['README.txt']
38 def getReadme(self, **kwargs):
40 This is the pyHesiodFS FUSE automounter. To access a Hesiod filsys,
41 just access /mit/name.
43 If you're using the Finder, try pressing Cmd+Shift+G and then entering
47 if __name__ == '__main__':
48 routefs.main(PyHesiodFS)