RUN_INSIDE_LXC to ynh_lxc_run_inside

This commit is contained in:
yalh76 2022-10-24 00:21:50 +02:00
parent 52e814db28
commit be8035b442
3 changed files with 11 additions and 11 deletions

View file

@ -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/

View file

@ -17,6 +17,10 @@ ynh_lxc_stop () {
}
ynh_lxc_run_inside () {
lxc exec $LXC_NAME -- "$@"
}
_ynh_lxc_start_and_wait () {

View file

@ -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 -- "$@"
}