Commit 7a30c5a8 authored by cnoirot's avatar cnoirot
Browse files

Handle no ###USER### to replace. Bug on docker/

parent 82f68ca5
......@@ -29,7 +29,7 @@ class JFlowConfigReader(object):
"""
CONFIG_FILE_PATH = "../../application.properties"
USER_PATTERN = re.compile("###USER###")
def __init__(self):
"""
"""
......@@ -37,12 +37,18 @@ class JFlowConfigReader(object):
self.reader.read(os.path.join(os.path.dirname(inspect.getfile(self.__class__)), self.CONFIG_FILE_PATH))
def get_tmp_directory(self):
if not os.path.isdir(self.reader.get("storage", "tmp_directory").replace("###USER###",os.getenv("USER"))):
os.makedirs(self.reader.get("storage", "tmp_directory").replace("###USER###",os.getenv("USER")), 0o751)
return self.reader.get("storage", "tmp_directory").replace("###USER###",os.getenv("USER"))
tmp_dir=self.reader.get("storage", "tmp_directory")
if self.USER_PATTERN.search(self.reader.get("storage", "tmp_directory")) is not None :
tmp_dir=tmp_dir.replace("###USER###",os.getenv("USER"))
if not os.path.isdir(tmp_dir):
os.makedirs(tmp_dir, 0o751)
return tmp_dir
def get_work_directory(self):
return self.reader.get("storage", "work_directory").replace("###USER###",os.getenv("USER"))
if self.USER_PATTERN.search(self.reader.get("storage", "work_directory")) is None :
return self.reader.get("storage", "work_directory")
else:
return self.reader.get("storage", "work_directory").replace("###USER###",os.getenv("USER"))
def get_exec(self, software):
try:
......@@ -59,9 +65,13 @@ class JFlowConfigReader(object):
@return: the path to the log file
"""
try:
return self.reader.get('storage', 'log_file').replace("###USER###",os.getenv("USER"))
if self.USER_PATTERN.search(self.reader.get("storage", "log_file")) is None :
return self.reader.get('storage', 'log_file')
else :
return self.reader.get('storage', 'log_file').replace("###USER###",os.getenv("USER"))
except :
raise NoOptionError("Failed when parsing the config file, no section logging found!")
def get_makeflow_path(self):
try:
......@@ -118,6 +128,12 @@ class JFlowConfigReader(object):
return self.reader.get("components", component_class+".batch_options")
except:
return ""
def get_component_modules(self, component_class):
try:
return self.reader.get("components", component_class+".modules").split(",")
except:
return []
def get_workflow_group(self, workflow_class):
try:
......
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