Browse Source

some corretions

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

18
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,20 +34,25 @@ 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"
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
pathname = job.conf.confs.get("paths").get("program") + "/utils/configs/" + name + ".yml"
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
pathname = job.conf.confs.get("paths").get("environment") + "/" + job.par.environment + "/configs/tool_" + name + ".yml"
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
@ -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)

Loading…
Cancel
Save