3 RouteFS Example: HomeFS
5 If you work on a system where home directories are on network storage
6 (i.e. not in /home), mount HomeFS on /home. It's an automounter that
7 will automatically create symlinks from user -> their homedir whenever
8 /home/user is accessed in any way.
14 from routes import Mapper
19 class HomeFS(routefs.RouteFS):
20 controllers = ['getList', 'getUser']
21 def __init__(self, *args, **kwargs):
22 super(HomeFS, self).__init__(*args, **kwargs)
27 m.connect('', controller='getList')
28 m.connect(':action', controller='getUser')
31 def getUser(self, action, **kwargs):
33 if action not in self.cache:
34 self.cache[action] = pwd.getpwnam(action).pw_dir
35 return routefs.Symlink(self.cache[action])
39 def getList(self, **kwargs):
40 return self.cache.keys()
43 if __name__ == '__main__':