Handle relative paths in module_defaults_dir

This now handles strings as well as sct_dicts with type=file that
include relative paths.

Signed-off-by: Petr Šabata <contyk@redhat.com>
This commit is contained in:
Petr Šabata 2018-04-04 14:01:10 +02:00 committed by Lubomír Sedlář
parent 0e7f770fb7
commit b9523ff5b0

View File

@ -151,6 +151,11 @@ def create_comps_repo(compose, arch):
def write_module_defaults(compose):
scm_dict = compose.conf["module_defaults_dir"]
if isinstance(scm_dict, dict):
if scm_dict["scm"] == "file":
scm_dict["dir"] = os.path.join(compose.config_dir, scm_dict["dir"])
else:
scm_dict = os.path.join(compose.config_dir, scm_dict)
with temp_dir(prefix="moduledefaults_") as tmp_dir:
get_dir_from_scm(scm_dict, tmp_dir, logger=compose._logger)