Commits

Anonymous committed b95daec

Allow different logpaths.

Comments (0)

Files changed (2)

     'setenv': 1,
 
     # logging
-    'transferlog': check_path(0, 'dir'),
-    'errorlog': check_path(0, 'dir'),
-    'customlog': check_path(0, 'dir'),
+    'transferlog': check_path(0, 'dir', 'logpaths'),
+    'errorlog': check_path(0, 'dir', 'logpaths'),
+    'customlog': check_path(0, 'dir', 'logpaths'),
     'logformat': 1,
     'loglevel': 1,
 

rac/validators.py

 
 from rac.check import ValidationError
 
-def check_path(which, mustexist=None):
+def check_path(which, mustexist=None, pathlist='acceptable_paths'):
     def check(config, user, node):
         args = shlex.split(node.args)
         try:
             myarg = args[which]
         except:
             raise ValidationError('not enough args')
-        acceptable = config.get('acceptable_paths', ['/home/%(user)s',
-                                                     '/var/www/%(user)s'])
+        acceptable = config.get(pathlist, ['/home/%(user)s',
+                                           '/var/www/%(user)s'])
         real_acc = [x % {'user': user} for x in acceptable]
         for accpath in real_acc:
             if myarg.startswith(accpath):