From 978d22d95284674f38d4c5bcdefd96a5f038ecb0 Mon Sep 17 00:00:00 2001 From: sukunis Date: Wed, 17 Mar 2021 17:31:04 +0100 Subject: [PATCH] handle customize or empty paths for ManagedRepository or OMERO --- .../scripts/omero/Create_OpenLink.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/omero-openlink/omero_openlink/scripts/omero/Create_OpenLink.py b/omero-openlink/omero_openlink/scripts/omero/Create_OpenLink.py index d0b235e..f575432 100644 --- a/omero-openlink/omero_openlink/scripts/omero/Create_OpenLink.py +++ b/omero-openlink/omero_openlink/scripts/omero/Create_OpenLink.py @@ -87,11 +87,25 @@ def get_omero_paths(client): managed_repo_dir = None orig_repo_dir = None for desc in repos.descriptions: - if desc.name.val == "ManagedRepository": + if "ManagedRepository".lower() in desc.name.val.lower(): managed_repo_dir = desc.path.val + desc.name.val - if desc.name.val == "OMERO": + if "OMERO".lower() in desc.name.val.lower(): orig_repo_dir = desc.path.val + desc.name.val + # if the repo paths could not be identify, check custom configurations from config of omero + if not managed_repo_dir: + managed_repo_dir=client.sf.getConfigService().getConfigValue("omero.managed.dir"); + if not orig_repo_dir: + orig_repo_dir=client.sf.getConfigService().getConfigValue("omero.data.dir"); + + # catching empty paths + if not managed_repo_dir: + print("ERROR: no specification was found for managed repository path. Please check path of type Managed under \n >>omero fs repos \n or the value of omero.managed.dir under\n >>omero config get") + return None,None + + if not orig_repo_dir: + print("ERROR: no specification was found for omero repository path. Please check path of type Public under \n >>omero fs repos \n or the value of omero.data.dir under\n >>omero config get") + return None,None if managed_repo_dir and not managed_repo_dir.endswith('/'): managed_repo_dir = managed_repo_dir + '/'