Commit ccf7dbf8 authored by MAISSIAT's avatar MAISSIAT
Browse files

Fix read configuration

parent e04033bc
......@@ -747,9 +747,16 @@ class Download(threading.Thread):
self.__data_reader_subpath = self.__configuration.destination.subpath
if isinstance(self.__configuration.destination.spoolLink, list):
self.__local_added_spool_links = self.__configuration.destination.spoolLink
else:
if len(self.__configuration.destination.spoolLink) == 0 \
or self.__configuration.destination.spoolLink[0] is None:
self.__local_added_spool_links = []
else:
self.__local_added_spool_links = self.__configuration.destination.spoolLink
elif self.__configuration.destination.spoolLink is not None \
and self.__configuration.destination.spoolLink != "":
self.__local_added_spool_links = self.__configuration.destination.spoolLink.split(';')
else:
self.__local_added_spool_links = []
for dir_link in self.__local_added_spool_links:
if not os.path.isdir(dir_link):
raise Exception(f"Invalid path for links {dir_link} : directory does not exist")
......@@ -811,9 +818,16 @@ class Download(threading.Thread):
self.__misc_param_integrity_check = 'SAFE'
if isinstance(self.__configuration.destination.optionalSpool, list):
self.__local_optional_storage_spool = self.__configuration.destination.optionalSpool
else:
if len(self.__configuration.destination.optionalSpool) == 0 \
or self.__configuration.destination.optionalSpool[0] is None:
self.__local_optional_storage_spool = []
else:
self.__local_optional_storage_spool = self.__configuration.destination.optionalSpool
elif self.__configuration.destination.optionalSpool is not None \
and self.__configuration.destination.optionalSpool != "":
self.__local_optional_storage_spool = self.__configuration.destination.optionalSpool.split(';')
else:
self.__local_optional_storage_spool = []
for path in self.__local_optional_storage_spool:
if not os.path.isdir(path):
raise Exception(f"Invalid destination optional location {path} : directory does not exist")
......
......@@ -463,6 +463,8 @@ def reset_errors(id, **kwargs):
db_path = os.path.join(globalConfig.getPath("work"),
os.path.join(work_id, 'internal'),
f'downloader_{id}.db')
database = None
nb_errors = 0
try:
database = DownloaderDatabase(id, 'sqlite:///' + db_path)
database.createEngine(db_must_exist=True)
......@@ -483,7 +485,8 @@ def reset_errors(id, **kwargs):
nb_errors = - nb_errors
finally:
database.closeSession()
if database is not None:
database.closeSession()
return nb_errors
......
......@@ -10,7 +10,7 @@ author-email = sherleda@ifremer.fr
license = GPLv3
# Python version
requires-python = >=3.8 <3.9
requires-python >=3.8
# Installation -------------
......
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