Skip to content

Commit

Permalink
chore(jans-linux-setup) remove spanner db (#10068)
Browse files Browse the repository at this point in the history
* chore(jans-linux-setup): remove spanner

Signed-off-by: Mustafa Baser <[email protected]>

* fix(jans-linux-setup): index keylenght for TEXT fields

Signed-off-by: Mustafa Baser <[email protected]>

---------

Signed-off-by: Mustafa Baser <[email protected]>
  • Loading branch information
devrimyatar authored Nov 6, 2024
1 parent 04af3b4 commit 6e00e72
Show file tree
Hide file tree
Showing 18 changed files with 104 additions and 1,192 deletions.
10 changes: 1 addition & 9 deletions jans-linux-setup/jans_setup/setup_app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get(self, attr, default=None):

@classmethod
def set_mapping_locations(self):
ptype = 'rdbm' if self.persistence_type in ('sql', 'spanner') else self.persistence_type
ptype = 'rdbm' if self.persistence_type in ('sql',) else self.persistence_type
self.mapping_locations = { group: ptype for group in self.couchbaseBucketDict }

@classmethod
Expand Down Expand Up @@ -167,13 +167,6 @@ def progress(self, service_name, msg, incr=False):
self.rdbm_password_enc = ''
self.static_rdbm_dir = os.path.join(self.install_dir, 'static/rdbm')

#spanner
self.spanner_project = 'jans-project'
self.spanner_instance = 'jans-instance'
self.spanner_database = 'jansdb'
self.spanner_emulator_host = None
self.google_application_credentials = None

# Jans components installation status
self.loadData = True
self.install_jans = True
Expand Down Expand Up @@ -256,7 +249,6 @@ def progress(self, service_name, msg, incr=False):
self.jans_python_readme = os.path.join(self.jansOptPythonFolder, 'libs/python.txt')
self.jansCouchebaseProperties = os.path.join(self.configFolder, 'jans-couchbase.properties')
self.jansRDBMProperties = os.path.join(self.configFolder, 'jans-sql.properties')
self.jansSpannerProperties = os.path.join(self.configFolder, 'jans-spanner.properties')

self.ldif_base = os.path.join(self.output_dir, 'base.ldif')
self.ldif_attributes = os.path.join(self.output_dir, 'attributes.ldif')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ def external_libs(self):
common_lib_dir = None
if Config.cb_install:
common_lib_dir = base.current_app.CouchbaseInstaller.common_lib_dir
elif Config.rdbm_install and Config.rdbm_type == 'spanner':
common_lib_dir = base.current_app.RDBMInstaller.common_lib_dir

if common_lib_dir:
class_path = os.path.join(common_lib_dir, '*')
current_plugins = self.get_plugins(paths=True)
Expand Down
3 changes: 0 additions & 3 deletions jans-linux-setup/jans_setup/setup_app/installers/jetty.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,6 @@ def in_war(name):
if Config.cb_install:
common_lib_dir = base.current_app.CouchbaseInstaller.common_lib_dir

elif Config.rdbm_install and Config.rdbm_type == 'spanner':
common_lib_dir = base.current_app.RDBMInstaller.common_lib_dir

if common_lib_dir:

add_custom_lib_dir = []
Expand Down
227 changes: 75 additions & 152 deletions jans-linux-setup/jans_setup/setup_app/installers/rdbm.py

Large diffs are not rendered by default.

16 changes: 1 addition & 15 deletions jans-linux-setup/jans_setup/setup_app/setup_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ def get_setup_options():
if base.argsp.remote_rdbm:
setupOptions['rdbm_install_type'] = InstallTypes.REMOTE
setupOptions['rdbm_type'] = base.argsp.remote_rdbm
if not base.argsp.remote_rdbm == 'spanner':
setupOptions['rdbm_host'] = base.argsp.rdbm_host
setupOptions['rdbm_host'] = base.argsp.rdbm_host

else:
setupOptions['rdbm_install_type'] = InstallTypes.LOCAL
Expand All @@ -58,19 +57,6 @@ def get_setup_options():
if base.argsp.rdbm_password:
setupOptions['rdbm_password'] = base.argsp.rdbm_password

if base.current_app.profile == 'jans':
if base.argsp.spanner_project:
setupOptions['spanner_project'] = base.argsp.spanner_project
if base.argsp.spanner_instance:
setupOptions['spanner_instance'] = base.argsp.spanner_instance
if base.argsp.spanner_database:
setupOptions['spanner_database'] = base.argsp.spanner_database
if base.argsp.spanner_emulator_host:
setupOptions['spanner_emulator_host'] = base.argsp.spanner_emulator_host
if base.argsp.google_application_credentials:
setupOptions['google_application_credentials'] = base.argsp.google_application_credentials


if base.current_app.profile == 'jans':

if base.argsp.local_couchbase:
Expand Down
5 changes: 0 additions & 5 deletions jans-linux-setup/jans_setup/setup_app/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,15 @@ class colors:
DANGER = '\033[31m'

class BackendTypes:
LDAP = 1
COUCHBASE = 2
MYSQL = 3
PGSQL = 4
SPANNER = 5

class BackendStrings:
REMOTE_OPENDJ = 'Remote OpenDj'
LOCAL_COUCHBASE = 'Local Couchbase'
REMOTE_COUCHBASE = 'Remote Couchbase'
LOCAL_MYSQL = 'Local MySQL'
REMOTE_MYSQL = 'Remote MySQL'
CLOUD_SPANNER = 'Cloud Spanner'
SAPNNER_EMULATOR = 'Spanner Emulator'
LOCAL_PGSQL = 'Local PgSQL'
REMOTE_PGSQL = 'Remote PgSQL'

Expand Down
21 changes: 4 additions & 17 deletions jans-linux-setup/jans_setup/setup_app/test_data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ def load_test_data(self):
Config.pbar.progress(self.service_name, "Rendering templates", False)
self.logIt("Rendering test templates")

if Config.rdbm_type == 'spanner':
Config.rdbm_password_enc = ''

Config.templateRenderingDict['config_jans_auth_test_ldap'] = '# Not available'
Config.templateRenderingDict['config_jans_auth_test_couchbase'] = '# Not available'

Expand All @@ -146,16 +143,9 @@ def load_test_data(self):


if self.getMappingType('rdbm'):

if Config.rdbm_type == 'spanner':
template_text = self.readFile(os.path.join(self.template_base, 'jans-auth/server/config-jans-auth-test-spanner.properties.nrnd'))
rendered_text = self.fomatWithDict(template_text, self.merge_dicts(Config.__dict__, Config.templateRenderingDict))
config_jans_auth_test_properties += '\n#spanner\n' + rendered_text

else:
template_text = self.readFile(os.path.join(self.template_base, 'jans-auth/server/config-jans-auth-test-sql.properties.nrnd'))
rendered_text = self.fomatWithDict(template_text, self.merge_dicts(Config.__dict__, Config.templateRenderingDict))
config_jans_auth_test_properties += '\n#sql\n' + rendered_text
template_text = self.readFile(os.path.join(self.template_base, 'jans-auth/server/config-jans-auth-test-sql.properties.nrnd'))
rendered_text = self.fomatWithDict(template_text, self.merge_dicts(Config.__dict__, Config.templateRenderingDict))
config_jans_auth_test_properties += '\n#sql\n' + rendered_text

self.logIt("Adding custom attributs and indexes")

Expand Down Expand Up @@ -193,11 +183,8 @@ def load_test_data(self):
json.dump(scim_schema, w, indent=2)

self.dbUtils.read_jans_schema(others=jans_schema_json_files)

base.current_app.RDBMInstaller.create_tables(jans_schema_json_files)

if Config.rdbm_type != 'spanner':
self.dbUtils.rdm_automapper(force=True)
self.dbUtils.rdm_automapper(force=True)

self.writeFile(
os.path.join(Config.output_dir, 'test/jans-auth/server/config-jans-auth-test.properties'),
Expand Down
10 changes: 1 addition & 9 deletions jans-linux-setup/jans_setup/setup_app/utils/arg_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
parser.add_argument('-encode-salt', help="24 characters length string to be used for encoding passwords")

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('-remote-rdbm', choices=['mysql', 'pgsql'], help="Enables using remote RDBM server")
rdbm_group.add_argument('-local-rdbm', choices=['mysql', 'pgsql'], help="Enables installing/configuring local RDBM server", default='pgsql')
parser.add_argument('-ip-address', help="Used primarily by Apache httpd for the Listen directive")
parser.add_argument('-host-name', help="Internet-facing FQDN that is used to generate certificates and metadata.")
Expand Down Expand Up @@ -107,14 +107,6 @@

parser.add_argument('-config-patch-creds', help="password:username for downloading auto test ciba password")

# 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")

# test-client
parser.add_argument('-test-client-id', help="ID of test client which has all available scopes. Must be in UUID format.")
parser.add_argument('-test-client-pw', help="Secret for test client")
Expand Down
22 changes: 2 additions & 20 deletions jans-linux-setup/jans_setup/setup_app/utils/collect_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,10 @@ def collect(self):
jans_auth_ConfigurationEntryDN = jans_prop['jansAuth_ConfigurationEntryDN']
jans_ConfigurationDN = 'ou=configuration,o=jans'

if Config.persistence_type in ('couchbase', 'sql', 'spanner'):
default_storage = Config.persistence_type
elif Config.persistence_type == 'ldap':
if Config.persistence_type in ('couchbase', 'sql'):
default_storage = Config.persistence_type

if not Config.persistence_type in ('ldap', 'sql', 'spanner') and os.path.exists(Config.jansCouchebaseProperties):
if os.path.exists(Config.jansCouchebaseProperties):
jans_cb_prop = base.read_properties_file(Config.jansCouchebaseProperties)

Config.couchebaseClusterAdmin = jans_cb_prop['auth.userName']
Expand Down Expand Up @@ -84,22 +82,6 @@ def collect(self):
if Config.rdbm_type == 'postgresql':
Config.rdbm_type = 'pgsql'

if not Config.persistence_type in ('couchbase', 'ldap') and Config.get('jansSpannerProperties') and os.path.exists(Config.jansSpannerProperties):
Config.rdbm_type = 'spanner'
jans_spanner_prop = base.read_properties_file(Config.jansSpannerProperties)

Config.spanner_project = jans_spanner_prop['connection.project']
Config.spanner_instance = jans_spanner_prop['connection.instance']
Config.spanner_database = jans_spanner_prop['connection.database']

if 'connection.emulator-host' in jans_spanner_prop:
Config.spanner_emulator_host = jans_spanner_prop['connection.emulator-host'].split(':')[0]
Config.templateRenderingDict['spanner_creds'] = 'connection.emulator-host={}:9010'.format(Config.spanner_emulator_host)

elif 'auth.credentials-file' in jans_spanner_prop:
Config.google_application_credentials = jans_spanner_prop['auth.credentials-file']
Config.templateRenderingDict['spanner_creds'] = 'auth.credentials-file={}'.format(Config.google_application_credentials)

if not Config.get('couchbase_bucket_prefix'):
Config.couchbase_bucket_prefix = 'jans'

Expand Down
Loading

0 comments on commit 6e00e72

Please sign in to comment.