Skip to content

Commit

Permalink
More adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
krateng committed Nov 13, 2023
1 parent 9655817 commit 12064f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
2 changes: 0 additions & 2 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 4 additions & 7 deletions maloja/pkg_global/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def get_env_vars(key,pathsuffix=[]):
# 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']
Expand All @@ -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}")
Expand All @@ -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!")
Expand All @@ -130,7 +128,7 @@ def find_good_folder(datatype,configobject):

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
Expand Down Expand Up @@ -267,7 +265,7 @@ def find_good_folder(datatype,configobject):
pass
# otherwise, find a good one
else:
find_good_folder(datatype,malojaconfig)
malojaconfig[directory_info[datatype]['setting']] = find_good_folder(datatype)



Expand Down Expand Up @@ -320,8 +318,7 @@ def find_good_folder(datatype,configobject):
# 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!")
Expand Down

0 comments on commit 12064f6

Please sign in to comment.