Commit 5b34159b authored by Nicolas Wavrant's avatar Nicolas Wavrant

runner: realpath function shouldn't fail if unneeded paths are not present in the config

This also makes the function easier to test
parent 6bceac64
...@@ -129,7 +129,7 @@ def getCurrentSoftwareReleaseProfile(config): ...@@ -129,7 +129,7 @@ def getCurrentSoftwareReleaseProfile(config):
return realpath( return realpath(
config, os.path.join(software_folder, config['software_profile'])) config, os.path.join(software_folder, config['software_profile']))
# XXXX No Comments # XXXX No Comments
except: except IOError:
return '' return ''
...@@ -762,16 +762,11 @@ def realpath(config, path, check_exist=True): ...@@ -762,16 +762,11 @@ def realpath(config, path, check_exist=True):
""" """
split_path = path.split('/') split_path = path.split('/')
key = split_path[0] key = split_path[0]
allow_list = { virtual_path_list = ('software_root', 'instance_root', 'workspace',
'software_root': config['software_root'], 'runner_workdir', 'software_link')
'instance_root': config['instance_root'], if key not in virtual_path_list:
'workspace': config['workspace'],
'runner_workdir': config['runner_workdir'],
'software_link': config['software_link']
}
if key not in allow_list:
return '' return ''
allow_list = {path: config[path] for path in virtual_path_list if path in config}
del split_path[0] del split_path[0]
path = os.path.join(allow_list[key], *split_path) path = os.path.join(allow_list[key], *split_path)
if check_exist: if check_exist:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment