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