From 12064f6d99620646c4dbc0f960e5daf83d91600a Mon Sep 17 00:00:00 2001 From: krateng Date: Mon, 13 Nov 2023 15:52:22 +0100 Subject: [PATCH] More adjustments --- Containerfile | 2 -- maloja/pkg_global/conf.py | 11 ++++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Containerfile b/Containerfile index 03de792..9ae9198 100644 --- a/Containerfile +++ b/Containerfile @@ -70,9 +70,7 @@ COPY container/root/ / ENV \ # Docker-specific configuration MALOJA_SKIP_SETUP=yes \ - # indicate that we are in a container MALOJA_CONTAINER=yes \ - # log flush PYTHONUNBUFFERED=1 \ # Prevents breaking change for previous container that ran maloja as root # On linux hosts (non-podman rootless) these variables should be set to the diff --git a/maloja/pkg_global/conf.py b/maloja/pkg_global/conf.py index 34e0ede..26ff692 100644 --- a/maloja/pkg_global/conf.py +++ b/maloja/pkg_global/conf.py @@ -92,7 +92,7 @@ directory_info = { # checks if one has been in use before and writes it to dict/config # if not, determines which to use and writes it to dict/config # returns determined folder -def find_good_folder(datatype,configobject): +def find_good_folder(datatype): info = directory_info[datatype] possible_folders = info['possible_folders'] @@ -104,7 +104,6 @@ def find_good_folder(datatype,configobject): if os.path.exists(pthj(p,info['sentinel'])): if is_dir_usable(p): #print(p,"was apparently used as maloja's folder for",datatype,"- fixing in settings") - configobject[info['setting']] = p return p else: raise PermissionError(f"Can no longer use previously used {datatype} folder {p}") @@ -114,7 +113,6 @@ def find_good_folder(datatype,configobject): for p in possible_folders: if is_dir_usable(p): #print(p,"has been selected as maloja's folder for",datatype) - configobject[info['setting']] = p return p #print("No folder can be used for",datatype) #print("This should not happen!") @@ -130,7 +128,7 @@ maloja_dir_config = os.environ.get("MALOJA_DATA_DIRECTORY") or os.environ.get("M if maloja_dir_config is None: # if nothing is set, we set our own - maloja_dir_config = find_good_folder('config',{}) + maloja_dir_config = find_good_folder('config') else: pass # if there is an environment variable, this is 100% explicitly defined by the user, so we respect it @@ -267,7 +265,7 @@ if not malojaconfig.readonly: pass # otherwise, find a good one else: - find_good_folder(datatype,malojaconfig) + malojaconfig[directory_info[datatype]['setting']] = find_good_folder(datatype) @@ -320,8 +318,7 @@ for identifier,path in data_directories.items(): # just move to the next one if identifier in ['cache']: print("Cannot use",path,"for cache, finding new folder...") - find_good_folder('cache',malojaconfig) - data_directories['cache'] = dir_settings['cache'] = malojaconfig['DIRECTORY_CACHE'] + data_directories['cache'] = dir_settings['cache'] = malojaconfig['DIRECTORY_CACHE'] = find_good_folder('cache') else: print("Directory",path,"is not usable.") print("Please change permissions or settings!")