From 71e2c46ee4f508324834803f5eb43c749c6aeb10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sat, 31 Aug 2024 11:23:10 +0200 Subject: [PATCH] Cleanup after auto patch --- manifest.toml | 1 - scripts/_common.sh | 245 ++++++----------------------- scripts/remove | 2 +- sources/update_config_if_needed.sh | 96 +++++------ tests.toml | 2 +- 5 files changed, 98 insertions(+), 248 deletions(-) diff --git a/manifest.toml b/manifest.toml index a0b938b..fa40ad1 100644 --- a/manifest.toml +++ b/manifest.toml @@ -53,7 +53,6 @@ ram.runtime = "50M" [resources.install_dir] group = "www-data:r-x" - dir = "/opt/yunohost/__APP__" owner = "__APP__:rwx" group = "www-data:rx" diff --git a/scripts/_common.sh b/scripts/_common.sh index c287769..10b6dd2 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -16,7 +16,7 @@ readonly var_list_to_manage='mysql_installed postgresql_installed memcached_inst installed_php_fpm_filter() { while read -r item; do local version=${item%,*} - if _ynh_apt_package_is_installedphp"$version"-fpm; then + if _ynh_apt_package_is_installed php"$version"-fpm; then echo "$item" fi done @@ -45,27 +45,27 @@ load_vars() { # This function is called by the hook in install/upgrade/remove yunohost operation # We we need to ensure that this function the quickest as possible # Note that we don't use the yunohost command intentionally for optimization - if _ynh_apt_package_is_installedmysql || _ynh_apt_package_is_installedmariadb-server; then + if _ynh_apt_package_is_installed mysql || _ynh_apt_package_is_installed mariadb-server; then readonly mysql_installed=true else readonly mysql_installed=false fi - if _ynh_apt_package_is_installedpostgresql; then + if _ynh_apt_package_is_installed postgresql; then readonly postgresql_installed=true else readonly postgresql_installed=false fi - if _ynh_apt_package_is_installedmemcached; then + if _ynh_apt_package_is_installed memcached; then readonly memcached_installed=true else readonly memcached_installed=false fi - if _ynh_apt_package_is_installedredis-server; then + if _ynh_apt_package_is_installed redis-server; then readonly redis_installed=true else readonly redis_installed=false fi - if _ynh_apt_package_is_installed'php*-fpm'; then + if _ynh_apt_package_is_installed 'php*-fpm'; then readonly phpfpm_installed=true else readonly phpfpm_installed=false @@ -181,7 +181,7 @@ config_php_fpm() { for pool_dir_by_version in /etc/php/*; do pool_version=$(echo "$pool_dir_by_version" | cut -d/ -f4) pool_file="/etc/php/$pool_version/fpm/pool.d/${app}_status.conf" - if _ynh_apt_package_is_installed"php$pool_version-fpm"; then + if _ynh_apt_package_is_installed "php$pool_version-fpm"; then ynh_config_add --jinja --template=_php_status.conf --destination="$pool_file" chown root:root "$pool_file" @@ -223,190 +223,41 @@ configure_alerts_email() { } ensure_vars_set() { -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=db_pwd --value="$(ynh_string_random --length=12)" - if [ -z "${db_pwd:-}" ]; then - db_pwd="$(ynh_string_random --length=12)" - ynh_app_setting_set --key=db_pwd --value="$db_pwd" - fi - -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=alerts_email --value="admins@$domain" - if [ -z "${alerts_email:-}" ]; then - alerts_email="admins@$domain" - ynh_app_setting_set --key=alerts_email --value="$alerts_email" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=enable_hourly_view --value=n - if [ -z "${enable_hourly_view:-}" ]; then - enable_hourly_view=n - ynh_app_setting_set --key=enable_hourly_view --value="$enable_hourly_view" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=image_format --value=svg - if [ -z "${image_format:-}" ]; then - image_format=svg - ynh_app_setting_set --key=image_format --value="$image_format" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=theme_color --value=black - if [ -z "${theme_color:-}" ]; then - theme_color=black - ynh_app_setting_set --key=theme_color --value="$theme_color" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=max_historic_years --value=5 - if [ -z "${max_historic_years:-}" ]; then - max_historic_years=5 - ynh_app_setting_set --key=max_historic_years --value="$max_historic_years" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=process_priority --value=0 - if [ -z "${process_priority:-}" ]; then - process_priority=0 - ynh_app_setting_set --key=process_priority --value="$process_priority" - fi - -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=system_alerts_loadavg_enabled --value=n - if [ -z "${system_alerts_loadavg_enabled:-}" ]; then - system_alerts_loadavg_enabled=n - ynh_app_setting_set --key=system_alerts_loadavg_enabled --value="$system_alerts_loadavg_enabled" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=system_alerts_loadavg_timeintvl --value=3600 - if [ -z "${system_alerts_loadavg_timeintvl:-}" ]; then - system_alerts_loadavg_timeintvl=3600 - ynh_app_setting_set --key=system_alerts_loadavg_timeintvl --value="$system_alerts_loadavg_timeintvl" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=system_alerts_loadavg_threshold --value=5.0 - if [ -z "${system_alerts_loadavg_threshold:-}" ]; then - system_alerts_loadavg_threshold=5.0 - ynh_app_setting_set --key=system_alerts_loadavg_threshold --value="$system_alerts_loadavg_threshold" - fi - -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=disk_alerts_loadavg_enabled --value=false - if [ -z "${disk_alerts_loadavg_enabled:-}" ]; then - disk_alerts_loadavg_enabled=false - ynh_app_setting_set --key=disk_alerts_loadavg_enabled --value="$disk_alerts_loadavg_enabled" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=disk_alerts_loadavg_timeintvl --value=3600 - if [ -z "${disk_alerts_loadavg_timeintvl:-}" ]; then - disk_alerts_loadavg_timeintvl=3600 - ynh_app_setting_set --key=disk_alerts_loadavg_timeintvl --value="$disk_alerts_loadavg_timeintvl" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=disk_alerts_loadavg_threshold --value=98 - if [ -z "${disk_alerts_loadavg_threshold:-}" ]; then - disk_alerts_loadavg_threshold=98 - ynh_app_setting_set --key=disk_alerts_loadavg_threshold --value="$disk_alerts_loadavg_threshold" - fi - -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=mail_delvd_enabled --value=n - if [ -z "${mail_delvd_enabled:-}" ]; then - mail_delvd_enabled=n - ynh_app_setting_set --key=mail_delvd_enabled --value="$mail_delvd_enabled" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=mail_delvd_timeintvl --value=60 - if [ -z "${mail_delvd_timeintvl:-}" ]; then - mail_delvd_timeintvl=60 - ynh_app_setting_set --key=mail_delvd_timeintvl --value="$mail_delvd_timeintvl" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=mail_delvd_threshold --value=100 - if [ -z "${mail_delvd_threshold:-}" ]; then - mail_delvd_threshold=100 - ynh_app_setting_set --key=mail_delvd_threshold --value="$mail_delvd_threshold" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=mail_mqueued_enabled --value=n - if [ -z "${mail_mqueued_enabled:-}" ]; then - mail_mqueued_enabled=n - ynh_app_setting_set --key=mail_mqueued_enabled --value="$mail_mqueued_enabled" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=mail_mqueued_timeintvl --value=3600 - if [ -z "${mail_mqueued_timeintvl:-}" ]; then - mail_mqueued_timeintvl=3600 - ynh_app_setting_set --key=mail_mqueued_timeintvl --value="$mail_mqueued_timeintvl" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=mail_mqueued_threshold --value=100 - if [ -z "${mail_mqueued_threshold:-}" ]; then - mail_mqueued_threshold=100 - ynh_app_setting_set --key=mail_mqueued_threshold --value="$mail_mqueued_threshold" - fi - -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_enabled --value=n - if [ -z "${emailreports_enabled:-}" ]; then - emailreports_enabled=n - ynh_app_setting_set --key=emailreports_enabled --value="$emailreports_enabled" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_subject_prefix --value='Monitorix:' - if [ -z "${emailreports_subject_prefix:-}" ]; then - emailreports_subject_prefix='Monitorix:' - ynh_app_setting_set --key=emailreports_subject_prefix --value="$emailreports_subject_prefix" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_hour --value=0 - if [ -z "${emailreports_hour:-}" ]; then - emailreports_hour=0 - ynh_app_setting_set --key=emailreports_hour --value="$emailreports_hour" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_minute --value=0 - if [ -z "${emailreports_minute:-}" ]; then - emailreports_minute=0 - ynh_app_setting_set --key=emailreports_minute --value="$emailreports_minute" - fi - -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_daily_enabled --value=n - if [ -z "${emailreports_daily_enabled:-}" ]; then - emailreports_daily_enabled=n - ynh_app_setting_set --key=emailreports_daily_enabled --value="$emailreports_daily_enabled" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_daily_graphs --value='system,fs' - if [ -z "${emailreports_daily_graphs:-}" ]; then - emailreports_daily_graphs='system,fs' - ynh_app_setting_set --key=emailreports_daily_graphs --value="$emailreports_daily_graphs" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_daily_to --value="admins@$domain" - if [ -z "${emailreports_daily_to:-}" ]; then - emailreports_daily_to="admins@$domain" - ynh_app_setting_set --key=emailreports_daily_to --value="$emailreports_daily_to" - fi - -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_weekly_enabled --value=n - if [ -z "${emailreports_weekly_enabled:-}" ]; then - emailreports_weekly_enabled=n - ynh_app_setting_set --key=emailreports_weekly_enabled --value="$emailreports_weekly_enabled" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_weekly_graphs --value='system,fs' - if [ -z "${emailreports_weekly_graphs:-}" ]; then - emailreports_weekly_graphs='system,fs' - ynh_app_setting_set --key=emailreports_weekly_graphs --value="$emailreports_weekly_graphs" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_weekly_to --value="admins@$domain" - if [ -z "${emailreports_weekly_to:-}" ]; then - emailreports_weekly_to="admins@$domain" - ynh_app_setting_set --key=emailreports_weekly_to --value="$emailreports_weekly_to" - fi - -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_monthly_enabled --value=n - if [ -z "${emailreports_monthly_enabled:-}" ]; then - emailreports_monthly_enabled=n - ynh_app_setting_set --key=emailreports_monthly_enabled --value="$emailreports_monthly_enabled" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_monthly_graphs --value='system,fs' - if [ -z "${emailreports_monthly_graphs:-}" ]; then - emailreports_monthly_graphs='system,fs' - ynh_app_setting_set --key=emailreports_monthly_graphs --value="$emailreports_monthly_graphs" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_monthly_to --value="admins@$domain" - if [ -z "${emailreports_monthly_to:-}" ]; then - emailreports_monthly_to="admins@$domain" - ynh_app_setting_set --key=emailreports_monthly_to --value="$emailreports_monthly_to" - fi - -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_yearly_enabled --value=n - if [ -z "${emailreports_yearly_enabled:-}" ]; then - emailreports_yearly_enabled=n - ynh_app_setting_set --key=emailreports_yearly_enabled --value="$emailreports_yearly_enabled" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_yearly_graphs --value='system,fs' - if [ -z "${emailreports_yearly_graphs:-}" ]; then - emailreports_yearly_graphs='system,fs' - ynh_app_setting_set --key=emailreports_yearly_graphs --value="$emailreports_yearly_graphs" - fi -# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=emailreports_yearly_to --value="admins@$domain" - if [ -z "${emailreports_yearly_to:-}" ]; then - emailreports_yearly_to="admins@$domain" - ynh_app_setting_set --key=emailreports_yearly_to --value="$emailreports_yearly_to" - fi + ynh_app_setting_set_default --key=db_pwd --value="$(ynh_string_random --length=12)" + ynh_app_setting_set_default --key=alerts_email --value="admins@$domain" + ynh_app_setting_set_default --key=enable_hourly_view --value=n + ynh_app_setting_set_default --key=image_format --value=svg + ynh_app_setting_set_default --key=theme_color --value=black + ynh_app_setting_set_default --key=max_historic_years --value=5 + ynh_app_setting_set_default --key=process_priority --value=0 + ynh_app_setting_set_default --key=system_alerts_loadavg_enabled --value=n + ynh_app_setting_set_default --key=system_alerts_loadavg_timeintvl --value=3600 + ynh_app_setting_set_default --key=system_alerts_loadavg_threshold --value=5.0 + ynh_app_setting_set_default --key=disk_alerts_loadavg_enabled --value=false + ynh_app_setting_set_default --key=disk_alerts_loadavg_timeintvl --value=3600 + ynh_app_setting_set_default --key=disk_alerts_loadavg_threshold --value=98 + ynh_app_setting_set_default --key=mail_delvd_enabled --value=n + ynh_app_setting_set_default --key=mail_delvd_timeintvl --value=60 + ynh_app_setting_set_default --key=mail_delvd_threshold --value=100 + ynh_app_setting_set_default --key=mail_mqueued_enabled --value=n + ynh_app_setting_set_default --key=mail_mqueued_timeintvl --value=3600 + ynh_app_setting_set_default --key=mail_mqueued_threshold --value=100 + ynh_app_setting_set_default --key=emailreports_enabled --value=n + ynh_app_setting_set_default --key=emailreports_subject_prefix --value='Monitorix:' + ynh_app_setting_set_default --key=emailreports_hour --value=0 + ynh_app_setting_set_default --key=emailreports_minute --value=0 + ynh_app_setting_set_default --key=emailreports_daily_enabled --value=n + ynh_app_setting_set_default --key=emailreports_daily_graphs --value='system,fs' + ynh_app_setting_set_default --key=emailreports_daily_to --value="admins@$domain" + ynh_app_setting_set_default --key=emailreports_weekly_enabled --value=n + ynh_app_setting_set_default --key=emailreports_weekly_graphs --value='system,fs' + ynh_app_setting_set_default --key=emailreports_weekly_to --value="admins@$domain" + ynh_app_setting_set_default --key=emailreports_monthly_enabled --value=n + ynh_app_setting_set_default --key=emailreports_monthly_graphs --value='system,fs' + ynh_app_setting_set_default --key=emailreports_monthly_to --value="admins@$domain" + ynh_app_setting_set_default --key=emailreports_yearly_enabled --value=n + ynh_app_setting_set_default --key=emailreports_yearly_graphs --value='system,fs' + ynh_app_setting_set_default --key=emailreports_yearly_to --value="admins@$domain" } set_permission() { @@ -414,17 +265,17 @@ set_permission() { chmod u=rX,g=rwX,o= -R /etc/monitorix chown www-data:root -R "$nginx_status_conf" chmod u=r,g=r,o= "$nginx_status_conf" - #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app":root "$install_dir" - #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod u=rwX,g=rwX,o= -R "$install_dir" + chown "$app":root "$install_dir" + chmod u=rwX,g=rwX,o= -R "$install_dir" chmod 750 "$install_dir"/monitorix-alert.sh - #REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app":root -R /var/log/"$app" - #REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod u=rwX,g=rwX,o= -R /var/log/"$app" + chown "$app":root -R /var/log/"$app" + chmod u=rwX,g=rwX,o= -R /var/log/"$app" chmod u=rwx,g=rx,o= "$data_dir" chown "$app":www-data "$data_dir" - #REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod u=rwx,g=rx,o= "$data_dir"/*.rrd || true - #REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app":root "$data_dir"/*.rrd || true + chmod u=rwx,g=rx,o= "$data_dir"/*.rrd || true + chown "$app":root "$data_dir"/*.rrd || true find "$data_dir"/{reports,usage} \( \! -perm -o= \ -o \! -user "$app" \ -o \! -group "$app" \) \ diff --git a/scripts/remove b/scripts/remove index f116a75..b19ce75 100755 --- a/scripts/remove +++ b/scripts/remove @@ -36,7 +36,7 @@ for pool_dir_by_version in /etc/php/*; do pool_version=$(echo "$pool_dir_by_version" | cut -d/ -f4) pool_file="/etc/php/$pool_version/fpm/pool.d/${app}_status.conf" ynh_safe_rm "$pool_file" - if _ynh_apt_package_is_installed"php$pool_version-fpm"; then + if _ynh_apt_package_is_installed "php$pool_version-fpm"; then ynh_systemctl --service="php$pool_version"-fpm.service --action=reload fi done diff --git a/sources/update_config_if_needed.sh b/sources/update_config_if_needed.sh index 5c353e7..c8996c2 100644 --- a/sources/update_config_if_needed.sh +++ b/sources/update_config_if_needed.sh @@ -4,7 +4,7 @@ set -eu app=__APP__ YNH_APP_BASEDIR=/etc/yunohost/apps/"$app" -YNH_HELPERS_VERSION=2 +YNH_HELPERS_VERSION=2.1 pushd /etc/yunohost/apps/$app/conf source ../scripts/_common.sh @@ -13,74 +13,74 @@ load_vars status_dirty=false for var in $var_list_to_manage; do - value="$(ynh_app_setting_get --app="$app" --key=previous_$var)" + value="$(ynh_app_setting_get --key=previous_$var)" if [ "${!var}" != "$value" ]; then status_dirty=true - ynh_print_info --message="The setting '$var' changed. Updating monitorix config." + ynh_print_info "The setting '$var' changed. Updating monitorix config." break fi done if "$status_dirty"; then - install_dir="$(ynh_app_setting_get --app="$app" --key=install_dir)" - data_dir="$(ynh_app_setting_get --app="$app" --key=data_dir)" - db_pwd="$(ynh_app_setting_get --app="$app" --key=db_pwd)" - domain="$(ynh_app_setting_get --app="$app" --key=domain)" - path="$(ynh_app_setting_get --app="$app" --key=path)" - port="$(ynh_app_setting_get --app="$app" --key=port)" - port_nginx_status="$(ynh_app_setting_get --app="$app" --key=port_nginx_status)" + install_dir="$(ynh_app_setting_get --key=install_dir)" + data_dir="$(ynh_app_setting_get --key=data_dir)" + db_pwd="$(ynh_app_setting_get --key=db_pwd)" + domain="$(ynh_app_setting_get --key=domain)" + path="$(ynh_app_setting_get --key=path)" + port="$(ynh_app_setting_get --key=port)" + port_nginx_status="$(ynh_app_setting_get --key=port_nginx_status)" - alerts_email="$(ynh_app_setting_get --app="$app" --key=alerts_email)" - enable_hourly_view="$(ynh_app_setting_get --app="$app" --key=enable_hourly_view)" - image_format="$(ynh_app_setting_get --app="$app" --key=image_format)" - theme_color="$(ynh_app_setting_get --app="$app" --key=theme_color)" - max_historic_years="$(ynh_app_setting_get --app="$app" --key=max_historic_years)" - process_priority="$(ynh_app_setting_get --app="$app" --key=process_priority)" + alerts_email="$(ynh_app_setting_get --key=alerts_email)" + enable_hourly_view="$(ynh_app_setting_get --key=enable_hourly_view)" + image_format="$(ynh_app_setting_get --key=image_format)" + theme_color="$(ynh_app_setting_get --key=theme_color)" + max_historic_years="$(ynh_app_setting_get --key=max_historic_years)" + process_priority="$(ynh_app_setting_get --key=process_priority)" - system_alerts_loadavg_enabled="$(ynh_app_setting_get --app="$app" --key=system_alerts_loadavg_enabled)" - system_alerts_loadavg_timeintvl="$(ynh_app_setting_get --app="$app" --key=system_alerts_loadavg_timeintvl)" - system_alerts_loadavg_threshold="$(ynh_app_setting_get --app="$app" --key=system_alerts_loadavg_threshold)" + system_alerts_loadavg_enabled="$(ynh_app_setting_get --key=system_alerts_loadavg_enabled)" + system_alerts_loadavg_timeintvl="$(ynh_app_setting_get --key=system_alerts_loadavg_timeintvl)" + system_alerts_loadavg_threshold="$(ynh_app_setting_get --key=system_alerts_loadavg_threshold)" - disk_alerts_loadavg_enabled="$(ynh_app_setting_get --app="$app" --key=disk_alerts_loadavg_enabled)" - disk_alerts_loadavg_timeintvl="$(ynh_app_setting_get --app="$app" --key=disk_alerts_loadavg_timeintvl)" - disk_alerts_loadavg_threshold="$(ynh_app_setting_get --app="$app" --key=disk_alerts_loadavg_threshold)" + disk_alerts_loadavg_enabled="$(ynh_app_setting_get --key=disk_alerts_loadavg_enabled)" + disk_alerts_loadavg_timeintvl="$(ynh_app_setting_get --key=disk_alerts_loadavg_timeintvl)" + disk_alerts_loadavg_threshold="$(ynh_app_setting_get --key=disk_alerts_loadavg_threshold)" - mail_delvd_enabled="$(ynh_app_setting_get --app="$app" --key=mail_delvd_enabled)" - mail_delvd_timeintvl="$(ynh_app_setting_get --app="$app" --key=mail_delvd_timeintvl)" - mail_delvd_threshold="$(ynh_app_setting_get --app="$app" --key=mail_delvd_threshold)" - mail_mqueued_enabled="$(ynh_app_setting_get --app="$app" --key=mail_mqueued_enabled)" - mail_mqueued_timeintvl="$(ynh_app_setting_get --app="$app" --key=mail_mqueued_timeintvl)" - mail_mqueued_threshold="$(ynh_app_setting_get --app="$app" --key=mail_mqueued_threshold)" + mail_delvd_enabled="$(ynh_app_setting_get --key=mail_delvd_enabled)" + mail_delvd_timeintvl="$(ynh_app_setting_get --key=mail_delvd_timeintvl)" + mail_delvd_threshold="$(ynh_app_setting_get --key=mail_delvd_threshold)" + mail_mqueued_enabled="$(ynh_app_setting_get --key=mail_mqueued_enabled)" + mail_mqueued_timeintvl="$(ynh_app_setting_get --key=mail_mqueued_timeintvl)" + mail_mqueued_threshold="$(ynh_app_setting_get --key=mail_mqueued_threshold)" - emailreports_enabled="$(ynh_app_setting_get --app="$app" --key=emailreports_enabled)" - emailreports_subject_prefix="$(ynh_app_setting_get --app="$app" --key=emailreports_subject_prefix)" - emailreports_hour="$(ynh_app_setting_get --app="$app" --key=emailreports_hour)" - emailreports_minute="$(ynh_app_setting_get --app="$app" --key=emailreports_minute)" + emailreports_enabled="$(ynh_app_setting_get --key=emailreports_enabled)" + emailreports_subject_prefix="$(ynh_app_setting_get --key=emailreports_subject_prefix)" + emailreports_hour="$(ynh_app_setting_get --key=emailreports_hour)" + emailreports_minute="$(ynh_app_setting_get --key=emailreports_minute)" - emailreports_daily_enabled="$(ynh_app_setting_get --app="$app" --key=emailreports_daily_enabled)" - emailreports_daily_graphs="$(ynh_app_setting_get --app="$app" --key=emailreports_daily_graphs)" - emailreports_daily_to="$(ynh_app_setting_get --app="$app" --key=emailreports_daily_to)" + emailreports_daily_enabled="$(ynh_app_setting_get --key=emailreports_daily_enabled)" + emailreports_daily_graphs="$(ynh_app_setting_get --key=emailreports_daily_graphs)" + emailreports_daily_to="$(ynh_app_setting_get --key=emailreports_daily_to)" - emailreports_weekly_enabled="$(ynh_app_setting_get --app="$app" --key=emailreports_weekly_enabled)" - emailreports_weekly_graphs="$(ynh_app_setting_get --app="$app" --key=emailreports_weekly_graphs)" - emailreports_weekly_to="$(ynh_app_setting_get --app="$app" --key=emailreports_weekly_to)" + emailreports_weekly_enabled="$(ynh_app_setting_get --key=emailreports_weekly_enabled)" + emailreports_weekly_graphs="$(ynh_app_setting_get --key=emailreports_weekly_graphs)" + emailreports_weekly_to="$(ynh_app_setting_get --key=emailreports_weekly_to)" - emailreports_monthly_enabled="$(ynh_app_setting_get --app="$app" --key=emailreports_monthly_enabled)" - emailreports_monthly_graphs="$(ynh_app_setting_get --app="$app" --key=emailreports_monthly_graphs)" - emailreports_monthly_to="$(ynh_app_setting_get --app="$app" --key=emailreports_monthly_to)" + emailreports_monthly_enabled="$(ynh_app_setting_get --key=emailreports_monthly_enabled)" + emailreports_monthly_graphs="$(ynh_app_setting_get --key=emailreports_monthly_graphs)" + emailreports_monthly_to="$(ynh_app_setting_get --key=emailreports_monthly_to)" - emailreports_yearly_enabled="$(ynh_app_setting_get --app="$app" --key=emailreports_yearly_enabled)" - emailreports_yearly_graphs="$(ynh_app_setting_get --app="$app" --key=emailreports_yearly_graphs)" - emailreports_yearly_to="$(ynh_app_setting_get --app="$app" --key=emailreports_yearly_to)" + emailreports_yearly_enabled="$(ynh_app_setting_get --key=emailreports_yearly_enabled)" + emailreports_yearly_graphs="$(ynh_app_setting_get --key=emailreports_yearly_graphs)" + emailreports_yearly_to="$(ynh_app_setting_get --key=emailreports_yearly_to)" - ynh_add_config --jinja --template=monitorix.conf --destination="/etc/monitorix/monitorix.conf" - ynh_add_config --jinja --template=nginx_status.conf --destination="$nginx_status_conf" + ynh_config_add --jinja --template=monitorix.conf --destination="/etc/monitorix/monitorix.conf" + ynh_config_add --jinja --template=nginx_status.conf --destination="$nginx_status_conf" configure_db if "$phpfpm_installed"; then config_php_fpm fi - ynh_systemd_action --service_name="$app" --action=restart --log_path='systemd' --line_match=' - Ok, ready.' - ynh_systemd_action --service_name=nginx --action=reload + ynh_systemctl --service_name="$app" --action=restart --log_path='systemd' --line_match=' - Ok, ready.' + ynh_systemctl --service_name=nginx --action=reload save_vars_current_value fi diff --git a/tests.toml b/tests.toml index 5951de9..4dff4ab 100644 --- a/tests.toml +++ b/tests.toml @@ -7,5 +7,5 @@ test_format = 1.0 exclude = [] test_upgrade_from.9e9d8e3ae23d3c1817d6a8ef6ae4a33370defa82.name = "v3.15.0~ynh3 (manifestv1 - old_version_for_CI_1)" - test_upgrade_from.9b82e772d59aa586dd2e0d5c7e9adac09f2d030e.name = "v3.15.0~ynh4 (pre refactoring)" + test_upgrade_from.7c45b5268c0ab2dedb92ebb0430e0aad84320d0f.name = "Before helper 2.1"