From 9e56257fce979dc9aa4f2c025cb7a4dee2b74304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 17 May 2024 16:37:11 +0200 Subject: [PATCH] Fix rest_api_admin_* settings --- scripts/install | 4 ++-- scripts/upgrade | 14 +++++++++++++- tests.toml | 2 ++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index fe3e742..2cbb984 100755 --- a/scripts/install +++ b/scripts/install @@ -33,8 +33,8 @@ ynh_app_setting_set --app="$app" --key="db_pwd_web" --value="$db_pwd_web" # mailman3 core configuration rest_api_admin_user="rest_admin" rest_api_admin_pwd=$(head -n15 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c15) -ynh_app_setting_set --app="$app" --key=rest_admin_user --value="$rest_api_admin_user" -ynh_app_setting_set --app="$app" --key=rest_admin_pwd --value="$rest_api_admin_pwd" +ynh_app_setting_set --app="$app" --key="rest_api_admin_user" --value="$rest_api_admin_user" +ynh_app_setting_set --app="$app" --key="rest_api_admin_pwd" --value="$rest_api_admin_pwd" # hyperkitty configuration archiver_key=$(head -n32 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c32) diff --git a/scripts/upgrade b/scripts/upgrade index f68aebd..255b05f 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,16 +20,28 @@ ynh_systemd_action --service_name="$app-web" --action="stop" #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +# Create missing db_user_* as copy of db_name_* if [ -z "$db_user_app" ]; then db_user_app="$db_name_app" ynh_app_setting_set --app="$app" --key="db_user_app" --value="$db_user_app" fi - if [ -z "$db_user_web" ]; then db_user_web="$db_name_web" ynh_app_setting_set --app="$app" --key="db_user_web" --value="$db_user_web" fi +# Migrate rest_admin_* -> rest_api_admin_* +if [ -z "$rest_api_admin_user" ]; then + rest_api_admin_user="$rest_admin_user" + ynh_app_setting_set --app="$app" --key="rest_api_admin_user" --value="$rest_api_admin_user" + ynh_app_setting_delete --app="$app" --key="rest_admin_user" +fi +if [ -z "$rest_api_admin_pwd" ]; then + rest_api_admin_pwd="$rest_admin_pwd" + ynh_app_setting_set --app="$app" --key="rest_api_admin_pwd" --value="$rest_api_admin_pwd" + ynh_app_setting_delete --app="$app" --key="rest_admin_pwd" +fi + #================================================= # ADD A CONFIGURATION #================================================= diff --git a/tests.toml b/tests.toml index 76a3dd2..509b515 100644 --- a/tests.toml +++ b/tests.toml @@ -4,6 +4,8 @@ test_format = 1.0 [default] + exclude = ["change_url"] + # ------------------------------- # Commits to test upgrade from # -------------------------------