runroot: friendlier parsing of path_subs config

This commit is contained in:
Mike McLean 2017-08-03 19:02:47 -04:00
parent 29f286a53c
commit 2347aee632
2 changed files with 23 additions and 2 deletions

View file

@ -62,7 +62,15 @@ class RunRootTask(koji.tasks.BaseTaskHandler):
if cp.has_option('paths', 'safe_roots'):
self.config['safe_roots'] = cp.get('paths', 'safe_roots').split(',')
if cp.has_option('paths', 'path_subs'):
self.config['path_subs'] = [x.split(',') for x in cp.get('paths', 'path_subs').split('\n')]
self.config['path_subs'] = []
for line in cp.get('paths', 'path_subs').splitlines():
line = line.strip()
if not line:
continue
sub = line.split(',')
if len(sub) != 2:
raise koji.GenericError('bad runroot substitution: %s' % sub)
self.config['path_subs'].append(sub)
# path section are in form 'path%d' while order is important as some
# paths can be mounted inside other mountpoints