1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Review fixes.

This commit is contained in:
mariadb-AlanMologorsky
2025-04-04 15:51:21 +03:00
committed by Alan Mologorsky
parent aa57a7684c
commit d17fc7d9be
6 changed files with 59 additions and 15 deletions

View File

@ -346,10 +346,10 @@ def broadcast_new_config(
# TODO: do not restart cluster when put xml config only with
# distribute secrets
if not CEJPasswordHandler.secretsfile_exists():
secrets_dict = CEJPasswordHandler.generate_secrets_data()
CEJPasswordHandler.save_secrets(secrets=secrets_dict)
secrets = CEJPasswordHandler.get_secrets_json()
body['secrets'] = secrets
logging.debug('No .secrets file found so not distrinuting it.')
else:
secrets = CEJPasswordHandler.get_secrets_json()
body['secrets'] = secrets
# TODO: remove test mode here and replace it by mock in tests
if test_mode:
@ -787,6 +787,7 @@ def get_cej_info(config_root):
:return: cej_host, cej_port, cej_username, cej_password
:rtype: tuple
"""
#TODO: move this to cej.py?
cej_node = config_root.find('./CrossEngineSupport')
cej_host = cej_node.find('Host').text or '127.0.0.1'
cej_port = cej_node.find('Port').text or '3306'
@ -802,8 +803,26 @@ def get_cej_info(config_root):
'Columnstore.xml has an empty CrossEngineSupport.Password tag'
)
if (
not CEJPasswordHandler.secretsfile_exists() and
CEJPasswordHandler.is_password_encrypted(cej_password)
):
logging.error(
'CrossengineSupport password seems to be encrypted '
'but no .secrets file exist. May be it\'s eventually removed.'
)
if CEJPasswordHandler.secretsfile_exists() and cej_password:
cej_password = CEJPasswordHandler.decrypt_password(cej_password)
if CEJPasswordHandler.is_password_encrypted(cej_password):
cej_password = CEJPasswordHandler.decrypt_password(cej_password)
else:
logging.error(
'CrossengineSupport password seems to be unencrypted but '
'.secrets file exist. May be .secrets file generated by '
'mistake or password left encrypted after using cskeys '
'utility.'
)
return cej_host, cej_port, cej_username, cej_password