From 1d1e97997e2f24691975179c7d7fa81cbe50f16c Mon Sep 17 00:00:00 2001 From: Mustafa Baser Date: Mon, 21 Feb 2022 22:33:24 +0300 Subject: [PATCH] fix: flex-linux-setup able to use existing jans-setup to be used as standalone script --- flex-linux-setup/flex_linux_setup/flex_setup.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/flex-linux-setup/flex_linux_setup/flex_setup.py b/flex-linux-setup/flex_linux_setup/flex_setup.py index 1f66491a6..e0dd50348 100755 --- a/flex-linux-setup/flex_linux_setup/flex_setup.py +++ b/flex-linux-setup/flex_linux_setup/flex_setup.py @@ -15,10 +15,19 @@ print("Please install Jans Config Api then execute this script.") sys.exit() -import jans_setup -sys.path.append(jans_setup.__path__[0]) - __STATIC_SETUP_DIR__ = '/opt/jans/jans-setup/' + + +try: + import jans_setup + sys.path.append(jans_setup.__path__[0]) +except ModuleNotFoundError: + if os.path.exists(__STATIC_SETUP_DIR__): + sys.path.append(__STATIC_SETUP_DIR__) + else: + print("Unable to locate jans-setup, exiting ...") + sys.exit() + logs_dir = os.path.join(__STATIC_SETUP_DIR__, 'logs') if not os.path.exists(logs_dir):