From e204f11057489419132e8d6713ecb93db8cc90f2 Mon Sep 17 00:00:00 2001 From: Mustafa Baser Date: Wed, 7 Jul 2021 20:59:15 +0300 Subject: [PATCH] refactor(backend): disable rdbm --- gluu_install.py | 24 ++++++++++---------- setup.py | 14 +++++++----- setup_app/utils/arg_parser.py | 34 +++++++++++++++++------------ setup_app/utils/db_utils.py | 12 +++++----- setup_app/utils/properties_utils.py | 8 +++---- setup_app/utils/tui.py | 10 ++++----- 6 files changed, 55 insertions(+), 47 deletions(-) diff --git a/gluu_install.py b/gluu_install.py index 60a9b1cbf..fda46bde9 100644 --- a/gluu_install.py +++ b/gluu_install.py @@ -293,7 +293,7 @@ def package_oxd(): download(maven_base + '/org/gluu/super-gluu-radius-server/{0}{1}/super-gluu-radius-server-{0}{1}.jar'.format(app_versions['OX_VERSION'], app_versions['OX_GITVERISON']), os.path.join(gluu_app_dir, 'super-gluu-radius-server.jar')) download(maven_base + '/org/gluu/super-gluu-radius-server/{0}{1}/super-gluu-radius-server-{0}{1}-distribution.zip'.format(app_versions['OX_VERSION'], app_versions['OX_GITVERISON']), os.path.join(gluu_app_dir, 'gluu-radius-libs.zip')) download(maven_base + '/org/gluu/oxShibbolethKeyGenerator/{0}{1}/oxShibbolethKeyGenerator-{0}{1}.jar'.format(app_versions['OX_VERSION'], app_versions['OX_GITVERISON']), os.path.join(gluu_app_dir, 'idp3_cml_keygenerator.jar')) - download('https://github.com/sqlalchemy/sqlalchemy/archive/rel_1_3_23.zip', os.path.join(app_dir, 'sqlalchemy.zip')) + #download('https://github.com/sqlalchemy/sqlalchemy/archive/rel_1_3_23.zip', os.path.join(app_dir, 'sqlalchemy.zip')) download('https://www.apple.com/certificateauthority/Apple_WebAuthn_Root_CA.pem', os.path.join(app_dir, 'Apple_WebAuthn_Root_CA.pem')) for uf in services: @@ -364,19 +364,19 @@ def extract_from_ces(src, target_fn): shutil.rmtree(target_dir) -download_gcs() +#download_gcs() -sqlalchemy_zfn = os.path.join(app_dir, 'sqlalchemy.zip') -sqlalchemy_zip = zipfile.ZipFile(sqlalchemy_zfn, "r") -sqlalchemy_par_dir = sqlalchemy_zip.namelist()[0] -tmp_dir = os.path.join('/tmp', os.urandom(2).hex()) -sqlalchemy_zip.extractall(tmp_dir) -shutil.copytree( - os.path.join(tmp_dir, sqlalchemy_par_dir, 'lib/sqlalchemy'), - os.path.join(ces_dir, 'setup_app/pylib/sqlalchemy') - ) -shutil.rmtree(tmp_dir) +#sqlalchemy_zfn = os.path.join(app_dir, 'sqlalchemy.zip') +#sqlalchemy_zip = zipfile.ZipFile(sqlalchemy_zfn, "r") +#sqlalchemy_par_dir = sqlalchemy_zip.namelist()[0] +#tmp_dir = os.path.join('/tmp', os.urandom(2).hex()) +#sqlalchemy_zip.extractall(tmp_dir) +#shutil.copytree( +# os.path.join(tmp_dir, sqlalchemy_par_dir, 'lib/sqlalchemy'), +# os.path.join(ces_dir, 'setup_app/pylib/sqlalchemy') +# ) +#shutil.rmtree(tmp_dir) os.chmod('/install/community-edition-setup/setup.py', 33261) diff --git a/setup.py b/setup.py index 20d8b920f..5a8e2bcba 100755 --- a/setup.py +++ b/setup.py @@ -67,7 +67,7 @@ from setup_app.installers.radius import RadiusInstaller from setup_app.installers.oxd import OxdInstaller from setup_app.installers.casa import CasaInstaller -from setup_app.installers.rdbm import RDBMInstaller +#from setup_app.installers.rdbm import RDBMInstaller if base.snap: try: @@ -169,7 +169,7 @@ nodeInstaller = NodeInstaller() openDjInstaller = OpenDjInstaller() couchbaseInstaller = CouchbaseInstaller() -rdbmInstaller = RDBMInstaller() +#rdbmInstaller = RDBMInstaller() httpdinstaller = HttpdInstaller() oxauthInstaller = OxauthInstaller() oxtrustInstaller = OxtrustInstaller() @@ -181,13 +181,15 @@ passportInstaller = PassportInstaller() radiusInstaller = RadiusInstaller() -rdbmInstaller.packageUtils = packageUtils +#rdbmInstaller.packageUtils = packageUtils if Config.installed_instance: for installer in (openDjInstaller, couchbaseInstaller, httpdinstaller, oxauthInstaller, passportInstaller, scimInstaller, fidoInstaller, samlInstaller, oxdInstaller, - casaInstaller, radiusInstaller, rdbmInstaller): + casaInstaller, radiusInstaller, + #rdbmInstaller + ): setattr(Config, installer.install_var, installer.installed()) @@ -301,8 +303,8 @@ def do_installation(): if Config.cb_install: couchbaseInstaller.start_installation() - if Config.rdbm_install: - rdbmInstaller.start_installation() + #if Config.rdbm_install: + # rdbmInstaller.start_installation() if (Config.installed_instance and 'installHttpd' in Config.addPostSetupService) or (not Config.installed_instance and Config.installHttpd): httpdinstaller.configure() diff --git a/setup_app/utils/arg_parser.py b/setup_app/utils/arg_parser.py index 426fdc0bc..8ce268a44 100644 --- a/setup_app/utils/arg_parser.py +++ b/setup_app/utils/arg_parser.py @@ -30,15 +30,17 @@ def arg_parser(): ldap_group.add_argument('--install-local-wrends', help="Installs local WrenDS", action='store_true') ldap_group.add_argument('--disable-local-ldap', help="Disables installing local LDAP server", action='store_true') - rdbm_group = parser.add_mutually_exclusive_group() - rdbm_group.add_argument('-remote-rdbm', choices=['mysql', 'pgsql', 'spanner'], help="Enables using remote RDBM server") - rdbm_group.add_argument('-local-rdbm', choices=['mysql', 'pgsql'], help="Enables installing/configuring local RDBM server") + - parser.add_argument('-rdbm-user', help="RDBM username") - parser.add_argument('-rdbm-password', help="RDBM password") - parser.add_argument('-rdbm-port', help="RDBM port") - parser.add_argument('-rdbm-db', help="RDBM database") - parser.add_argument('-rdbm-host', help="RDBM host") + #rdbm_group = parser.add_mutually_exclusive_group() + #rdbm_group.add_argument('-remote-rdbm', choices=['mysql', 'pgsql', 'spanner'], help="Enables using remote RDBM server") + #rdbm_group.add_argument('-local-rdbm', choices=['mysql', 'pgsql'], help="Enables installing/configuring local RDBM server") + + #parser.add_argument('-rdbm-user', help="RDBM username") + #parser.add_argument('-rdbm-password', help="RDBM password") + #parser.add_argument('-rdbm-port', help="RDBM port") + #parser.add_argument('-rdbm-db', help="RDBM database") + #parser.add_argument('-rdbm-host', help="RDBM host") parser.add_argument('--remote-couchbase', help="Enables using remote couchbase server", action='store_true') parser.add_argument('--local-couchbase', help="Enables installing couchbase server", action='store_true') @@ -73,14 +75,18 @@ def arg_parser(): parser.add_argument('--no-progress', help="Use simple progress", action='store_true') # spanner options - parser.add_argument('-spanner-project', help="Spanner project name") - parser.add_argument('-spanner-instance', help="Spanner instance name") - parser.add_argument('-spanner-database', help="Spanner database name") - spanner_cred_group = parser.add_mutually_exclusive_group() - spanner_cred_group.add_argument('-spanner-emulator-host', help="Use Spanner emulator host") - spanner_cred_group.add_argument('-google-application-credentials', help="Path to Google application credentials json file") + #parser.add_argument('-spanner-project', help="Spanner project name") + #parser.add_argument('-spanner-instance', help="Spanner instance name") + #parser.add_argument('-spanner-database', help="Spanner database name") + #spanner_cred_group = parser.add_mutually_exclusive_group() + #spanner_cred_group.add_argument('-spanner-emulator-host', help="Use Spanner emulator host") + #spanner_cred_group.add_argument('-google-application-credentials', help="Path to Google application credentials json file") argsp = parser.parse_args() + # set disabled attributes + argsp.local_rdbm = None + argsp.remote_rdbm = None + return argsp diff --git a/setup_app/utils/db_utils.py b/setup_app/utils/db_utils.py index 3aacdeb46..50db7b18a 100644 --- a/setup_app/utils/db_utils.py +++ b/setup_app/utils/db_utils.py @@ -21,15 +21,15 @@ from setup_app.utils.cbm import CBM from setup_app.utils import ldif_utils from setup_app.utils.attributes import attribDataTypes -from setup_app.utils.spanner import Spanner +#from setup_app.utils.spanner import Spanner -my_path = PurePath(os.path.dirname(os.path.realpath(__file__))) -sys.path.append(my_path.parent.joinpath('pylib/sqlalchemy')) +#my_path = PurePath(os.path.dirname(os.path.realpath(__file__))) +#sys.path.append(my_path.parent.joinpath('pylib/sqlalchemy')) -import sqlalchemy -import sqlalchemy.orm -import sqlalchemy.ext.automap +#import sqlalchemy +#import sqlalchemy.orm +#import sqlalchemy.ext.automap class DBUtils: diff --git a/setup_app/utils/properties_utils.py b/setup_app/utils/properties_utils.py index 634813031..faa933419 100644 --- a/setup_app/utils/properties_utils.py +++ b/setup_app/utils/properties_utils.py @@ -18,7 +18,7 @@ from setup_app.config import Config from setup_app.utils.setup_utils import SetupUtils -from setup_app.utils.spanner import Spanner +#from setup_app.utils.spanner import Spanner from setup_app.utils.db_utils import dbUtils from setup_app.pylib.jproperties import Properties @@ -666,9 +666,9 @@ def prompt_for_backend(self): backend_types = ['Local OpenDj', 'Remote OpenDj', 'Remote Couchbase', - 'Local MySQL', - 'Remote MySQL', - 'Cloud Spanner', + #'Local MySQL', + #'Remote MySQL', + #'Cloud Spanner', ] if 'couchbase' in self.getBackendTypes(): diff --git a/setup_app/utils/tui.py b/setup_app/utils/tui.py index a07f299aa..cc30b9a6c 100644 --- a/setup_app/utils/tui.py +++ b/setup_app/utils/tui.py @@ -24,7 +24,7 @@ from setup_app.utils import base from setup_app.utils.properties_utils import propertiesUtils from setup_app.utils.progress import gluuProgress -from setup_app.utils.spanner import Spanner +#from setup_app.utils.spanner import Spanner import npyscreen @@ -415,10 +415,10 @@ def do_beforeEditing(self): self.backend_types = ['Local OpenDj', 'Remote OpenDj', 'Remote Couchbase', - 'Local MySQL', - 'Remote MySQL', - 'Cloud Spanner', - 'Spanner Emulator', + #'Local MySQL', + #'Remote MySQL', + #'Cloud Spanner', + #'Spanner Emulator', ] if 'couchbase' in propertiesUtils.getBackendTypes():