diff --git a/.gitignore b/.gitignore index 615b047..987d91d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ .directory *swp +*~ +*.sw[op] +.DS_Store diff --git a/conf/monitorix-alert.sh b/conf/monitorix-alert.sh index cacb65f..c53420c 100644 --- a/conf/monitorix-alert.sh +++ b/conf/monitorix-alert.sh @@ -1,4 +1,5 @@ #!/bin/bash +# WARNING: Don't edit this file. All change will be removed after each app upgrade # # Example script used to execute an alert action. # diff --git a/conf/monitorix.conf b/conf/monitorix.conf index ee6869c..7d48456 100644 --- a/conf/monitorix.conf +++ b/conf/monitorix.conf @@ -1,5 +1,7 @@ # Monitorix - configuration file # +# WARNING: Don't edit this file. All change will be removed after each app upgrade +# # See monitorix.conf(5) manpage for a detailed description of each option. # diff --git a/hooks/post_app_install b/hooks/post_app_install index 8c20e3e..5280790 100644 --- a/hooks/post_app_install +++ b/hooks/post_app_install @@ -1,3 +1,3 @@ #!/bin/bash -bash __INSTALL_DIR__/update_config_if_needed.sh +bash __INSTALL_DIR__/update_config_if_needed.sh install diff --git a/hooks/post_app_remove b/hooks/post_app_remove index 8c20e3e..6dd5b97 100644 --- a/hooks/post_app_remove +++ b/hooks/post_app_remove @@ -1,3 +1,3 @@ #!/bin/bash -bash __INSTALL_DIR__/update_config_if_needed.sh +bash __INSTALL_DIR__/update_config_if_needed.sh remove diff --git a/hooks/post_app_upgrade b/hooks/post_app_upgrade index 8c20e3e..aa8cbdd 100644 --- a/hooks/post_app_upgrade +++ b/hooks/post_app_upgrade @@ -1,3 +1,3 @@ #!/bin/bash -bash __INSTALL_DIR__/update_config_if_needed.sh +bash __INSTALL_DIR__/update_config_if_needed.sh upgrade diff --git a/manifest.toml b/manifest.toml index 4566e58..b346d95 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,7 +7,7 @@ name = "Monitorix" description.en = "A system monitoring tool" description.fr = "Un outil de monitoring système" -version = "3.15.0~ynh8" +version = "3.15.0~ynh9" maintainers = ["Josué Tille"] @@ -20,7 +20,8 @@ code = "https://github.com/mikaku/Monitorix" cpe = "cpe:2.3:a:fibranet:monitorix" [integration] -yunohost = ">= 11.2.20" +yunohost = ">= 11.2.30" +helpers_version = "2.1" architectures = "all" multi_instance = false ldap = "not_relevant" @@ -51,9 +52,8 @@ ram.runtime = "50M" [resources.system_user] [resources.install_dir] - dir = "/opt/yunohost/__APP__" + group = "www-data:r-x" owner = "__APP__:rwx" - group = "www-data:rx" [resources.data_dir] diff --git a/scripts/_common.sh b/scripts/_common.sh index b2a61fc..8158f3f 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_package_is_installed --package=php"$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_package_is_installed --package=mysql || ynh_package_is_installed --package=mariadb-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_package_is_installed --package=postgresql; then + if _ynh_apt_package_is_installed postgresql; then readonly postgresql_installed=true else readonly postgresql_installed=false fi - if ynh_package_is_installed --package=memcached; then + if _ynh_apt_package_is_installed memcached; then readonly memcached_installed=true else readonly memcached_installed=false fi - if ynh_package_is_installed --package=redis-server; then + if _ynh_apt_package_is_installed redis-server; then readonly redis_installed=true else readonly redis_installed=false fi - if ynh_package_is_installed --package='php*-fpm'; then + if _ynh_apt_package_is_installed 'php*-fpm'; then readonly phpfpm_installed=true else readonly phpfpm_installed=false @@ -80,7 +80,7 @@ load_vars() { readonly net_gateway="$(ip --json route show default | jq -r '.[0].dev')" readonly net_interface_list="$(ip --json link show | jq -r '.[].ifname | select(. != "lo")' | interface_speed_map)" readonly net_max_speed="$(cat /sys/class/net/*/speed 2>/dev/null | sort | tail -n1 | sed 's|-1|1000|g')" - readonly ssh_port="$((grep ssh_port /etc/yunohost/settings.yml || echo 22) | cut -d: -f2 | xargs)" + readonly ssh_port="$((([ -e /etc/yunohost/settings.yml ] && grep ssh_port /etc/yunohost/settings.yml) || echo 22) | cut -d: -f2 | xargs)" readonly port_infos="$(python3 <= 8.0 so we ignore older pools readonly php_pools_infos="$(grep -E '^\[.*\]' \ --exclude=/etc/php/*/fpm/pool.d/"$app"_status.conf \ @@ -149,7 +149,7 @@ EOF # Used by update_config_if_needed.sh hook save_vars_current_value() { for var in $var_list_to_manage; do - ynh_app_setting_set --app="$app" --key="previous_$var" --value="${!var}" + ynh_app_setting_set --key="previous_$var" --value="${!var}" done } @@ -161,7 +161,7 @@ install_monitorix_package() { ynh_setup_source --dest_dir="$tempdir" --source_id="main" # Install the package - ynh_package_install "$tempdir/monitorix.deb" + _ynh_apt_install "$tempdir/monitorix.deb" cp -r /var/lib/monitorix/* "$data_dir"/ } @@ -181,32 +181,32 @@ 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_package_is_installed --package="php$pool_version-fpm"; then - ynh_add_config --jinja --template=_php_status.conf --destination="$pool_file" + 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" chmod 444 "$pool_file" - ynh_systemd_action --service_name="php$pool_version"-fpm.service --action=reload + ynh_systemctl --service="php$pool_version"-fpm.service --action=reload else if [ -e "$pool_file" ]; then - ynh_secure_remove --file="$pool_file" + ynh_safe_rm "$pool_file" fi fi done } configure_hooks() { - ynh_replace_string --match_string=__APP__ --replace_string="$app" --target_file=../hooks/post_iptable_rules - ynh_replace_string --match_string=__INSTALL_DIR__ --replace_string="$install_dir" --target_file=../hooks/post_app_install - ynh_replace_string --match_string=__INSTALL_DIR__ --replace_string="$install_dir" --target_file=../hooks/post_app_remove - ynh_replace_string --match_string=__INSTALL_DIR__ --replace_string="$install_dir" --target_file=../hooks/post_app_upgrade + ynh_replace --match=__APP__ --replace="$app" --file=../hooks/post_iptable_rules + ynh_replace --match=__INSTALL_DIR__ --replace="$install_dir" --file=../hooks/post_app_install + ynh_replace --match=__INSTALL_DIR__ --replace="$install_dir" --file=../hooks/post_app_remove + ynh_replace --match=__INSTALL_DIR__ --replace="$install_dir" --file=../hooks/post_app_upgrade cp ../sources/update_config_if_needed.sh "$install_dir"/ - ynh_replace_string --match_string=__APP__ --replace_string="$app" --target_file="$install_dir"/update_config_if_needed.sh + ynh_replace --match=__APP__ --replace="$app" --file="$install_dir"/update_config_if_needed.sh } configure_alerts_email() { - ynh_add_config --template=monitorix-alert.sh --destination="$install_dir"/monitorix-alert.sh + ynh_config_add --template=monitorix-alert.sh --destination="$install_dir"/monitorix-alert.sh for alias_file in system.loadavg-alert.sh \ fs.loadavg-alert.sh \ mail.mqueued-alert.sh \ @@ -215,7 +215,7 @@ configure_alerts_email() { alias_path="$install_dir/$alias_file" if [ ! -h "$alias_path" ]; then if [ -e "$alias_path" ]; then - ynh_secure_remove --file="$alias_path" + ynh_safe_rm "$alias_path" fi ln -s "$install_dir/monitorix-alert.sh" "$install_dir/$alias_file" fi @@ -223,155 +223,41 @@ configure_alerts_email() { } ensure_vars_set() { - if [ -z "${db_pwd:-}" ]; then - db_pwd="$(ynh_string_random 12)" - ynh_app_setting_set --app="$app" --key=db_pwd --value="$db_pwd" - fi - - if [ -z "${alerts_email:-}" ]; then - alerts_email="admins@$domain" - ynh_app_setting_set --app="$app" --key=alerts_email --value="$alerts_email" - fi - if [ -z "${enable_hourly_view:-}" ]; then - enable_hourly_view=n - ynh_app_setting_set --app="$app" --key=enable_hourly_view --value="$enable_hourly_view" - fi - if [ -z "${image_format:-}" ]; then - image_format=svg - ynh_app_setting_set --app="$app" --key=image_format --value="$image_format" - fi - if [ -z "${theme_color:-}" ]; then - theme_color=black - ynh_app_setting_set --app="$app" --key=theme_color --value="$theme_color" - fi - if [ -z "${max_historic_years:-}" ]; then - max_historic_years=5 - ynh_app_setting_set --app="$app" --key=max_historic_years --value="$max_historic_years" - fi - if [ -z "${process_priority:-}" ]; then - process_priority=0 - ynh_app_setting_set --app="$app" --key=process_priority --value="$process_priority" - fi - - if [ -z "${system_alerts_loadavg_enabled:-}" ]; then - system_alerts_loadavg_enabled=n - ynh_app_setting_set --app="$app" --key=system_alerts_loadavg_enabled --value="$system_alerts_loadavg_enabled" - fi - if [ -z "${system_alerts_loadavg_timeintvl:-}" ]; then - system_alerts_loadavg_timeintvl=3600 - ynh_app_setting_set --app="$app" --key=system_alerts_loadavg_timeintvl --value="$system_alerts_loadavg_timeintvl" - fi - if [ -z "${system_alerts_loadavg_threshold:-}" ]; then - system_alerts_loadavg_threshold=5.0 - ynh_app_setting_set --app="$app" --key=system_alerts_loadavg_threshold --value="$system_alerts_loadavg_threshold" - fi - - if [ -z "${disk_alerts_loadavg_enabled:-}" ]; then - disk_alerts_loadavg_enabled=false - ynh_app_setting_set --app="$app" --key=disk_alerts_loadavg_enabled --value="$disk_alerts_loadavg_enabled" - fi - if [ -z "${disk_alerts_loadavg_timeintvl:-}" ]; then - disk_alerts_loadavg_timeintvl=3600 - ynh_app_setting_set --app="$app" --key=disk_alerts_loadavg_timeintvl --value="$disk_alerts_loadavg_timeintvl" - fi - if [ -z "${disk_alerts_loadavg_threshold:-}" ]; then - disk_alerts_loadavg_threshold=98 - ynh_app_setting_set --app="$app" --key=disk_alerts_loadavg_threshold --value="$disk_alerts_loadavg_threshold" - fi - - if [ -z "${mail_delvd_enabled:-}" ]; then - mail_delvd_enabled=n - ynh_app_setting_set --app="$app" --key=mail_delvd_enabled --value="$mail_delvd_enabled" - fi - if [ -z "${mail_delvd_timeintvl:-}" ]; then - mail_delvd_timeintvl=60 - ynh_app_setting_set --app="$app" --key=mail_delvd_timeintvl --value="$mail_delvd_timeintvl" - fi - if [ -z "${mail_delvd_threshold:-}" ]; then - mail_delvd_threshold=100 - ynh_app_setting_set --app="$app" --key=mail_delvd_threshold --value="$mail_delvd_threshold" - fi - if [ -z "${mail_mqueued_enabled:-}" ]; then - mail_mqueued_enabled=n - ynh_app_setting_set --app="$app" --key=mail_mqueued_enabled --value="$mail_mqueued_enabled" - fi - if [ -z "${mail_mqueued_timeintvl:-}" ]; then - mail_mqueued_timeintvl=3600 - ynh_app_setting_set --app="$app" --key=mail_mqueued_timeintvl --value="$mail_mqueued_timeintvl" - fi - if [ -z "${mail_mqueued_threshold:-}" ]; then - mail_mqueued_threshold=100 - ynh_app_setting_set --app="$app" --key=mail_mqueued_threshold --value="$mail_mqueued_threshold" - fi - - if [ -z "${emailreports_enabled:-}" ]; then - emailreports_enabled=n - ynh_app_setting_set --app="$app" --key=emailreports_enabled --value="$emailreports_enabled" - fi - if [ -z "${emailreports_subject_prefix:-}" ]; then - emailreports_subject_prefix='Monitorix:' - ynh_app_setting_set --app="$app" --key=emailreports_subject_prefix --value="$emailreports_subject_prefix" - fi - if [ -z "${emailreports_hour:-}" ]; then - emailreports_hour=0 - ynh_app_setting_set --app="$app" --key=emailreports_hour --value="$emailreports_hour" - fi - if [ -z "${emailreports_minute:-}" ]; then - emailreports_minute=0 - ynh_app_setting_set --app="$app" --key=emailreports_minute --value="$emailreports_minute" - fi - - if [ -z "${emailreports_daily_enabled:-}" ]; then - emailreports_daily_enabled=n - ynh_app_setting_set --app="$app" --key=emailreports_daily_enabled --value="$emailreports_daily_enabled" - fi - if [ -z "${emailreports_daily_graphs:-}" ]; then - emailreports_daily_graphs='system,fs' - ynh_app_setting_set --app="$app" --key=emailreports_daily_graphs --value="$emailreports_daily_graphs" - fi - if [ -z "${emailreports_daily_to:-}" ]; then - emailreports_daily_to="admins@$domain" - ynh_app_setting_set --app="$app" --key=emailreports_daily_to --value="$emailreports_daily_to" - fi - - if [ -z "${emailreports_weekly_enabled:-}" ]; then - emailreports_weekly_enabled=n - ynh_app_setting_set --app="$app" --key=emailreports_weekly_enabled --value="$emailreports_weekly_enabled" - fi - if [ -z "${emailreports_weekly_graphs:-}" ]; then - emailreports_weekly_graphs='system,fs' - ynh_app_setting_set --app="$app" --key=emailreports_weekly_graphs --value="$emailreports_weekly_graphs" - fi - if [ -z "${emailreports_weekly_to:-}" ]; then - emailreports_weekly_to="admins@$domain" - ynh_app_setting_set --app="$app" --key=emailreports_weekly_to --value="$emailreports_weekly_to" - fi - - if [ -z "${emailreports_monthly_enabled:-}" ]; then - emailreports_monthly_enabled=n - ynh_app_setting_set --app="$app" --key=emailreports_monthly_enabled --value="$emailreports_monthly_enabled" - fi - if [ -z "${emailreports_monthly_graphs:-}" ]; then - emailreports_monthly_graphs='system,fs' - ynh_app_setting_set --app="$app" --key=emailreports_monthly_graphs --value="$emailreports_monthly_graphs" - fi - if [ -z "${emailreports_monthly_to:-}" ]; then - emailreports_monthly_to="admins@$domain" - ynh_app_setting_set --app="$app" --key=emailreports_monthly_to --value="$emailreports_monthly_to" - fi - - if [ -z "${emailreports_yearly_enabled:-}" ]; then - emailreports_yearly_enabled=n - ynh_app_setting_set --app="$app" --key=emailreports_yearly_enabled --value="$emailreports_yearly_enabled" - fi - if [ -z "${emailreports_yearly_graphs:-}" ]; then - emailreports_yearly_graphs='system,fs' - ynh_app_setting_set --app="$app" --key=emailreports_yearly_graphs --value="$emailreports_yearly_graphs" - fi - if [ -z "${emailreports_yearly_to:-}" ]; then - emailreports_yearly_to="admins@$domain" - ynh_app_setting_set --app="$app" --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() { @@ -388,7 +274,7 @@ set_permission() { chmod u=rwx,g=rx,o= "$data_dir" chown "$app":www-data "$data_dir" - chmod u=rwx,g=rx,o= "$data_dir"/*.rrd || true + chmod u=rw,g=r,o= "$data_dir"/*.rrd || true chown "$app":root "$data_dir"/*.rrd || true find "$data_dir"/{reports,usage} \( \! -perm -o= \ -o \! -user "$app" \ diff --git a/scripts/backup b/scripts/backup index d48d15c..08373d1 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,14 +1,6 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh -source ../settings/scripts/experimental_helper.sh source /usr/share/yunohost/helpers load_vars @@ -16,24 +8,21 @@ load_vars # STOP SYSTEMD SERVICE #================================================= if systemctl is-active "$app".service --quiet; then - ynh_print_warn --message="It's highly recommended to make your backup when the service is stopped. Please stop $app service with this command before to run the backup 'systemctl stop $app.service'" + ynh_print_warn "It's highly recommended to make your backup when the service is stopped. Please stop $app service with this command before to run the backup 'systemctl stop $app.service'" fi -#================================================= -# DECLARE DATA AND CONF FILES TO BACKUP -#================================================= -ynh_print_info --message="Declaring files to be backed up..." +ynh_print_info "Declaring files to be backed up..." #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_backup --src_path="/etc/$app/" -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_backup --src_path="$nginx_status_conf" +ynh_backup "/etc/$app/" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup "$nginx_status_conf" -ynh_print_info --message="Backing up code..." -ynh_backup --src_path="$install_dir" +ynh_print_info "Backing up code..." +ynh_backup "$install_dir" #================================================= # SPECIFIC BACKUP @@ -41,16 +30,16 @@ ynh_backup --src_path="$install_dir" # BACKUP SYSTEMD #================================================= -ynh_backup --src_path="/etc/systemd/system/$app.service" +ynh_backup "/etc/systemd/system/$app.service" #================================================= # BACKUP VARIOUS FILES #================================================= -ynh_backup --src_path="$data_dir" --is_big=1 +ynh_backup "$data_dir" #================================================= # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index 4ac7176..3b28f55 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,47 +1,37 @@ #!/bin/bash -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers load_vars -#================================================= -# STANDARD MODIFICATIONS #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 +ynh_script_progression "Stopping $app's systemd service..." -ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemctl --service="$app" --action="stop" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 +ynh_script_progression "Updating NGINX web server configuration..." -ynh_change_url_nginx_config +ynh_config_change_url_nginx #================================================= # SPECIFIC MODIFICATIONS #================================================= -ynh_script_progression --message="Updating a configuration file..." --weight=1 -ynh_add_config --jinja --template=monitorix.conf --destination=/etc/monitorix/monitorix.conf +ynh_script_progression "Updating configuration..." +ynh_config_add --jinja --template=monitorix.conf --destination=/etc/monitorix/monitorix.conf -#================================================= -# GENERIC FINALISATION #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name="$app" --action=start --log_path='systemd' --line_match=' - Ok, ready.' +ynh_script_progression "Starting $app's systemd service..." +ynh_systemctl --service="$app" --action=start --log_path='systemd' --wait_until=' - Ok, ready.' #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_script_progression "Change of URL completed for $app" diff --git a/scripts/config b/scripts/config index bdf1542..a3457b9 100644 --- a/scripts/config +++ b/scripts/config @@ -8,16 +8,14 @@ source ./_common.sh source /usr/share/yunohost/helpers -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors ynh_app_config_apply() { _ynh_app_config_apply load_vars - ynh_add_config --jinja --template=monitorix.conf --destination="/etc/monitorix/monitorix.conf" + ynh_config_add --jinja --template=monitorix.conf --destination="/etc/monitorix/monitorix.conf" save_vars_current_value } -#================================================= -# GENERIC FINALIZATION #================================================= ynh_app_config_run "$1" diff --git a/scripts/install b/scripts/install index 1057ad7..88f782f 100755 --- a/scripts/install +++ b/scripts/install @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers load_vars @@ -18,33 +12,33 @@ ensure_vars_set if [ -n "$(ls -A "$data_dir")" ]; then old_data_dir_path="${data_dir}_$(date '+%Y%m%d.%H%M%S')" - ynh_print_warn --message="Data directory was not empty. Data was moved to $old_data_dir_path" + ynh_print_warn "Data directory was not empty. Data was moved to $old_data_dir_path" mkdir -p "$old_data_dir_path" mv -t "$old_data_dir_path" "$data_dir"/* app_data_dirs="$(echo /home/yunohost.app/*)" fi mkdir -p /var/log/"$app" -ynh_systemd_action --service_name="$app" --action=stop --log_path=systemd --timeout=15 +ynh_systemctl --service="$app" --action=stop --log_path=systemd --timeout=15 #================================================= # SYSTEM CONFIGURATION #=================================================ç -ynh_script_progression --message="Adding configurations related to $app..." --weight=1 +ynh_script_progression "Adding configurations related to $app..." mkdir -p /etc/monitorix -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" -ynh_add_nginx_config -ynh_add_systemd_config +ynh_config_add_nginx +ynh_config_add_systemd yunohost service add "$app" --description=Monitorix --log=systemd -ynh_script_progression --message="Configuring databases access..." +ynh_script_progression "Configuring databases access..." configure_db -ynh_script_progression --message="Configuring php fpm access if needed..." +ynh_script_progression "Configuring php fpm access if needed..." if "$phpfpm_installed"; then config_php_fpm fi @@ -53,34 +47,30 @@ configure_hooks configure_alerts_email #================================================= -# STANDARD MODIFICATIONS -#================================================= -ynh_script_progression --message="Installing packages..." --weight=1 +ynh_script_progression "Installing packages..." # Download package and install it install_monitorix_package #================================================= -# GENERIC FINALIZATION -#================================================= -ynh_script_progression --message="Protecting directory..." +ynh_script_progression "Protecting directory..." set_permission -ynh_use_logrotate --logfile="/var/log/$app" +ynh_config_add_logrotate "/var/log/$app" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression "Starting $app's systemd service..." -ynh_systemd_action --service_name="$app" --action="start" --log_path='systemd' --line_match=' - Ok, ready.' +ynh_systemctl --service="$app" --action="start" --log_path='systemd' --wait_until=' - Ok, ready.' # when we change the value of 'listen [::1]:xxx;' nginx don't reload correctly the config, so force to restart to ensure that the new config are loaded -ynh_systemd_action --service_name=nginx.service --action=restart +ynh_systemctl --service=nginx.service --action=restart save_vars_current_value #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index d4c555a..cdcd09b 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers load_vars @@ -17,44 +11,44 @@ load_vars #================================================= # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status "$app" >/dev/null +if ynh_hide_warnings yunohost service status "$app" >/dev/null then - ynh_script_progression --message="Removing $app service integration..." --weight=3 + ynh_script_progression "Removing $app service integration..." yunohost service remove "$app" fi #================================================= # REMOVE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 +ynh_script_progression "Removing system configurations related to $app..." -ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" --timeout=15 +ynh_systemctl --service="$app" --action="stop" --log_path="systemd" --timeout=15 -ynh_secure_remove --file="$nginx_status_conf" -ynh_remove_nginx_config +ynh_safe_rm "$nginx_status_conf" +ynh_config_remove_nginx -ynh_remove_systemd_config +ynh_config_remove_systemd # Remove the app-specific logrotate config -ynh_remove_logrotate +ynh_config_remove_logrotate 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_secure_remove --file="$pool_file" - if ynh_package_is_installed --package="php$pool_version-fpm"; then - ynh_systemd_action --service_name="php$pool_version"-fpm.service --action=reload + ynh_safe_rm "$pool_file" + if _ynh_apt_package_is_installed "php$pool_version-fpm"; then + ynh_systemctl --service="php$pool_version"-fpm.service --action=reload fi done -if ynh_psql_user_exists --user="$db_user"; then - ynh_psql_drop_user "$db_user" -fi -if ynh_mysql_user_exists --user="$db_user"; then +if $mysql_installed && ynh_mysql_user_exists --user="$db_user"; then ynh_mysql_drop_user "$db_user" fi +if $postgresql_installed && ynh_psql_user_exists --user="$db_user"; then + ynh_psql_drop_user "$db_user" +fi -ynh_package_autopurge monitorix -ynh_secure_remove --file="$install_dir" +_ynh_apt autoremove --purge monitorix +ynh_safe_rm "$install_dir" -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 69a1eb8..99fea63 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,30 +1,22 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh -source ../settings/scripts/experimental_helper.sh source /usr/share/yunohost/helpers load_vars -ynh_script_progression --message="Configuring databases access..." +ynh_script_progression "Configuring databases access..." configure_db #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring files" --weight=1 +ynh_script_progression "Restoring files" -ynh_restore +ynh_restore_everything mkdir -p /var/log/"$app" systemctl enable "$app".service --quiet -ynh_script_progression --message="Configuring php fpm access if needed..." +ynh_script_progression "Configuring php fpm access if needed..." if "$phpfpm_installed"; then config_php_fpm fi @@ -34,34 +26,30 @@ yunohost service add "$app" --description="Monitorix" --log="systemd" #================================================= # RESTORE THE DEPENDENCIES #================================================= -ynh_script_progression --message="Restoring the dependencies..." --weight=1 +ynh_script_progression "Restoring the dependencies..." install_monitorix_package -ynh_systemd_action --service_name="$app" --action=stop --log_path=systemd --timeout=15 +ynh_systemctl --service="$app" --action=stop --log_path=systemd --timeout=15 #================================================= -# GENERIC FINALIZATION -#================================================= -ynh_script_progression --message="Protecting directory..." +ynh_script_progression "Protecting directory..." set_permission -ynh_use_logrotate --logfile="/var/log/$app" +ynh_config_add_logrotate "/var/log/$app" -#================================================= -# GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= -ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 +ynh_script_progression "Reloading NGINX web server and $app's service..." -ynh_systemd_action --service_name="$app" --action=start --log_path='systemd' --line_match=' - Ok, ready.' +ynh_systemctl --service="$app" --action=start --log_path='systemd' --wait_until=' - Ok, ready.' # when we change the value of 'listen [::1]:xxx;' nginx don't reload correctly the config, so force to restart to ensure that the new config are loaded -ynh_systemd_action --service_name=nginx.service --action=restart -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemctl --service=nginx.service --action=restart +ynh_systemctl --service=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 6ad851d..f7647e3 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,19 +1,9 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers load_vars -upgrade_type="$(ynh_check_app_version_changed)" - -#================================================= -# STANDARD UPGRADE STEPS #================================================= # MIGRATION 5 : Manage old settings #================================================= @@ -23,20 +13,20 @@ ensure_vars_set #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +ynh_script_progression "Ensuring downward compatibility..." # Fix issue on package deployement test -e /etc/monitorix/conf.d/00-debian.conf || touch /etc/monitorix/conf.d/00-debian.conf # Remove old hook if exist -ynh_secure_remove --file=/usr/share/yunohost/hooks/post_iptable_rules/50-"$app" +ynh_safe_rm /usr/share/yunohost/hooks/post_iptable_rules/50-"$app" #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 +ynh_script_progression "Stopping $app's systemd service..." -ynh_systemd_action --service_name="$app" --action=stop --log_path="/var/log/$app/$app.log" +ynh_systemctl --service="$app" --action=stop #================================================= # "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...) @@ -44,15 +34,12 @@ ynh_systemd_action --service_name="$app" --action=stop --log_path="/var/log/$app # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -if [ "$upgrade_type" == UPGRADE_APP ] -then - ynh_script_progression --message="Upgrading source files..." --weight=1 +ynh_script_progression "Upgrading source files..." - # Download, check integrity, uncompress and patch the source from manifest.toml - install_monitorix_package -fi +# Download, check integrity, uncompress and patch the source from manifest.toml +install_monitorix_package -ynh_systemd_action --service_name="$app" --action=stop --log_path=systemd --timeout=15 +ynh_systemctl --service="$app" --action=stop --log_path=systemd --timeout=15 #================================================= # MIGRATION 2 @@ -73,22 +60,22 @@ fi #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading configurations related to $app..." --weight=1 +ynh_script_progression "Upgrading configurations related to $app..." -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" if "$phpfpm_installed"; then config_php_fpm fi -ynh_add_nginx_config -ynh_add_systemd_config +ynh_config_add_nginx +ynh_config_add_systemd yunohost service add "$app" --description=Monitorix --log=systemd -ynh_script_progression --message="Configuring databases access..." +ynh_script_progression "Configuring databases access..." configure_db -ynh_script_progression --message="Configuring php fpm access if needed..." +ynh_script_progression "Configuring php fpm access if needed..." if "$phpfpm_installed"; then config_php_fpm fi @@ -97,26 +84,24 @@ configure_hooks configure_alerts_email #================================================= -# GENERIC FINALIZATION -#================================================= -ynh_script_progression --message="Protecting directory..." +ynh_script_progression "Protecting directory..." set_permission -ynh_use_logrotate --logfile="/var/log/$app" +ynh_config_add_logrotate "/var/log/$app" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression "Starting $app's systemd service..." -ynh_systemd_action --service_name="$app" --action=restart --log_path=systemd --line_match=' - Ok, ready.' +ynh_systemctl --service="$app" --action=restart --log_path=systemd --wait_until=' - Ok, ready.' # when we change the value of 'listen [::1]:xxx;' nginx don't reload correctly the config, so force to restart to ensure that the new config are loaded -ynh_systemd_action --service_name=nginx.service --action=restart +ynh_systemctl --service=nginx.service --action=restart save_vars_current_value #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed" diff --git a/sources/update_config_if_needed.sh b/sources/update_config_if_needed.sh index 5c353e7..c063d39 100644 --- a/sources/update_config_if_needed.sh +++ b/sources/update_config_if_needed.sh @@ -4,7 +4,8 @@ set -eu app=__APP__ YNH_APP_BASEDIR=/etc/yunohost/apps/"$app" -YNH_HELPERS_VERSION=2 +YNH_HELPERS_VERSION=2.1 +YNH_APP_ACTION="$1" pushd /etc/yunohost/apps/$app/conf source ../scripts/_common.sh @@ -13,74 +14,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="$app" --action=restart --log_path=systemd --wait_until=' - Ok, ready.' + ynh_systemctl --service=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"