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.
13 from routes import Mapper
15 class HomeFS(routefs.RouteFS):
16 controllers = ['getList', 'getUser']
17 def __init__(self, *args, **kwargs):
18 super(HomeFS, self).__init__(*args, **kwargs)
23 m.connect('', controller='getList')
24 m.connect(':action', controller='getUser')
27 def getUser(self, action, **kwargs):
29 if action not in self.cache:
30 self.cache[action] = pwd.getpwnam(action).pw_dir
31 return routefs.Symlink(self.cache[action])
35 def getList(self, **kwargs):
36 return self.cache.keys()
38 if __name__ == '__main__':