Browse Source

some corretions

master
Ulrich Carmesin 3 years ago
parent
commit
179c32eab6
  1. 36
      utils/config_tool.py

36
utils/config_tool.py

@ -21,7 +21,7 @@ import basic.constants as B
COMP_FILES = ["DATASTRUCTURE"] COMP_FILES = ["DATASTRUCTURE"]
CONFIG_FORMAT = ["yml", "json", "csv"] CONFIG_FORMAT = ["yml", "json", "csv"]
def getConfigPath(modul, name): def getConfigPath(modul, name, subname=""):
""" """
gets the most specified configuration of different sources gets the most specified configuration of different sources
Parameter: Parameter:
@ -34,23 +34,28 @@ def getConfigPath(modul, name):
* release << basis-conf * release << basis-conf
* testset << parameter/environ * testset << parameter/environ
* testcase << parameter * testcase << parameter
the parameter-files could be one of these file-types:
* yaml, json, csv
""" """
job = basic.program.Job.getInstance() job = basic.program.Job.getInstance()
verify = job.getDebugLevel("config_tool")-4 verify = job.getDebugLevel("config_tool")-4
job.debug(verify, "getConfig " + modul + ", " + name) job.debug(verify, "getConfig " + modul + ", " + name)
if modul == "tool": if modul == "tool":
pathname = job.conf.confs.get("paths").get("home") + "/configs/tool_" + name + ".yml" for format in CONFIG_FORMAT:
job.debug(verify, "1 " + pathname) pathname = os.path.join(job.conf.confs.get("paths").get("home") , "configs","tool_"+name+"."+format)
if os.path.exists(pathname): job.debug(verify, "1 " + pathname)
return pathname if os.path.exists(pathname):
pathname = job.conf.confs.get("paths").get("program") + "/utils/configs/" + name + ".yml" return pathname
job.debug(verify, "2 " + pathname) for format in CONFIG_FORMAT:
if os.path.exists(pathname): pathname = os.path.join(job.conf.confs.get("paths").get("program"), "utils", "configs", name+"."+format)
return pathname job.debug(verify, "2 " + pathname)
pathname = job.conf.confs.get("paths").get("environment") + "/" + job.par.environment + "/configs/tool_" + name + ".yml" if os.path.exists(pathname):
job.debug(verify, "3 " + pathname) return pathname
if os.path.exists(pathname): for format in CONFIG_FORMAT:
return pathname 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) job.debug(verify, "3x " + pathname)
elif modul == "comp": elif modul == "comp":
pathname = job.conf.confs.get("paths").get("home") + "/configs/comp_" + name + ".yml" 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) pathname = os.path.join(job.conf.confs.get("paths").get("program"), "components", basic.componentHandling.getComponentFolder(name), modul+"."+format)
if os.path.exists(pathname): if os.path.exists(pathname):
return 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: else:
pathname = utils.path_tool.composePath("tcparfile") pathname = utils.path_tool.composePath("tcparfile")
job.debug(verify, "7 " + pathname) job.debug(verify, "7 " + pathname)

Loading…
Cancel
Save