From 179c32eab6a0c7b1b171c4c1e0e0c0143757676b Mon Sep 17 00:00:00 2001 From: Ulrich Carmesin Date: Thu, 17 Mar 2022 22:14:58 +0100 Subject: [PATCH] some corretions --- utils/config_tool.py | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/utils/config_tool.py b/utils/config_tool.py index 42cc0b8..9f2474e 100644 --- a/utils/config_tool.py +++ b/utils/config_tool.py @@ -21,7 +21,7 @@ import basic.constants as B COMP_FILES = ["DATASTRUCTURE"] CONFIG_FORMAT = ["yml", "json", "csv"] -def getConfigPath(modul, name): +def getConfigPath(modul, name, subname=""): """ gets the most specified configuration of different sources Parameter: @@ -34,23 +34,28 @@ def getConfigPath(modul, name): * release << basis-conf * testset << parameter/environ * testcase << parameter + the parameter-files could be one of these file-types: + * yaml, json, csv """ job = basic.program.Job.getInstance() verify = job.getDebugLevel("config_tool")-4 job.debug(verify, "getConfig " + modul + ", " + name) if modul == "tool": - pathname = job.conf.confs.get("paths").get("home") + "/configs/tool_" + name + ".yml" - job.debug(verify, "1 " + pathname) - if os.path.exists(pathname): - return pathname - pathname = job.conf.confs.get("paths").get("program") + "/utils/configs/" + name + ".yml" - job.debug(verify, "2 " + pathname) - if os.path.exists(pathname): - return pathname - pathname = job.conf.confs.get("paths").get("environment") + "/" + job.par.environment + "/configs/tool_" + name + ".yml" - job.debug(verify, "3 " + pathname) - if os.path.exists(pathname): - return pathname + for format in CONFIG_FORMAT: + pathname = os.path.join(job.conf.confs.get("paths").get("home") , "configs","tool_"+name+"."+format) + job.debug(verify, "1 " + pathname) + if os.path.exists(pathname): + return pathname + for format in CONFIG_FORMAT: + pathname = os.path.join(job.conf.confs.get("paths").get("program"), "utils", "configs", name+"."+format) + job.debug(verify, "2 " + pathname) + if os.path.exists(pathname): + return pathname + for format in CONFIG_FORMAT: + pathname = os.path.join(job.conf.confs.get("paths").get("environment"), job.par.environment, "configs", "tool_"+ name+"."+format) + job.debug(verify, "3 " + pathname) + if os.path.exists(pathname): + return pathname job.debug(verify, "3x " + pathname) elif modul == "comp": pathname = job.conf.confs.get("paths").get("home") + "/configs/comp_" + name + ".yml" @@ -67,6 +72,11 @@ def getConfigPath(modul, name): pathname = os.path.join(job.conf.confs.get("paths").get("program"), "components", basic.componentHandling.getComponentFolder(name), modul+"."+format) if os.path.exists(pathname): return pathname + if len(subname) > 1: + pathname = os.path.join(job.conf.confs.get("paths").get("program"), "components", + basic.componentHandling.getComponentFolder(name), subname+"."+format) + if os.path.exists(pathname): + return pathname else: pathname = utils.path_tool.composePath("tcparfile") job.debug(verify, "7 " + pathname)