From be8035b4420435f8ec83c8879b3eb601dedd2927 Mon Sep 17 00:00:00 2001 From: yalh76 <yalh@yahoo.com> Date: Mon, 24 Oct 2022 00:21:50 +0200 Subject: [PATCH] RUN_INSIDE_LXC to ynh_lxc_run_inside --- lib/tests.sh | 4 ++-- lib/ynh_lxd | 4 ++++ lib/ynh_lxd_package_check | 14 +++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/tests.sh b/lib/tests.sh index bb72799..9690be0 100644 --- a/lib/tests.sh +++ b/lib/tests.sh @@ -530,7 +530,7 @@ TEST_BACKUP_RESTORE () { # Remove the previous residual backups rm -rf $TEST_CONTEXT/ynh_backups - RUN_INSIDE_LXC rm -rf /home/yunohost.backup/archives + ynh_lxc_run_inside rm -rf /home/yunohost.backup/archives # BACKUP # Made a backup if the installation succeed @@ -573,7 +573,7 @@ TEST_BACKUP_RESTORE () { ynh_lxc_snapshot_load snap0 # Remove the previous residual backups - RUN_INSIDE_LXC rm -rf /home/yunohost.backup/archives + ynh_lxc_run_inside rm -rf /home/yunohost.backup/archives # Place the copy of the backup archive in the container. lxc file push -r $TEST_CONTEXT/ynh_backups/archives $LXC_NAME/home/yunohost.backup/ diff --git a/lib/ynh_lxd b/lib/ynh_lxd index a48e270..7bbb1f1 100644 --- a/lib/ynh_lxd +++ b/lib/ynh_lxd @@ -17,6 +17,10 @@ ynh_lxc_stop () { } +ynh_lxc_run_inside () { + lxc exec $LXC_NAME -- "$@" +} + _ynh_lxc_start_and_wait () { diff --git a/lib/ynh_lxd_package_check b/lib/ynh_lxd_package_check index ca82a18..74723d8 100644 --- a/lib/ynh_lxd_package_check +++ b/lib/ynh_lxd_package_check @@ -27,7 +27,7 @@ ynh_lxc_pc_exec () { ynh_lxc_pc_witness_file_create () { [ "$2" = "file" ] && local action="touch" || local action="mkdir -p" - RUN_INSIDE_LXC $action $1 + ynh_lxc_run_inside $action $1 } ynh_lxc_pc_witness_files_set () { @@ -63,12 +63,12 @@ ynh_lxc_pc_witness_files_set () { ynh_lxc_pc_witness_file_create "/etc/systemd/system/witnessfile.service" file # Database - RUN_INSIDE_LXC mysqladmin --wait status > /dev/null 2>&1 - echo "CREATE DATABASE witnessdb" | RUN_INSIDE_LXC mysql --wait > /dev/null 2>&1 + ynh_lxc_run_inside mysqladmin --wait status > /dev/null 2>&1 + echo "CREATE DATABASE witnessdb" | ynh_lxc_run_inside mysql --wait > /dev/null 2>&1 } ynh_lxc_pc_witness_file_check () { - if RUN_INSIDE_LXC test ! -e "$1" + if ynh_lxc_run_inside test ! -e "$1" then log_error "The file $1 is missing ! Something gone wrong !" SET_RESULT "failure" witness @@ -107,7 +107,7 @@ ynh_lxc_pc_witness_files_check () { ynh_lxc_pc_witness_file_check "/etc/systemd/system/witnessfile.service" # Database - if ! RUN_INSIDE_LXC mysqlshow witnessdb > /dev/null 2>&1 + if ! ynh_lxc_run_inside mysqlshow witnessdb > /dev/null 2>&1 then log_error "The database witnessdb is missing ! Something gone wrong !" SET_RESULT "failure" witness @@ -174,7 +174,3 @@ ynh_lxc_pc_snapshot_create () { stop_timer 1 } - -RUN_INSIDE_LXC() { - lxc exec $LXC_NAME -- "$@" -}