LXC_CREATE to ynh_lxc_pc_create

This commit is contained in:
yalh76 2022-10-24 00:08:12 +02:00
parent 7c8e2c7c29
commit f0ce0e572e
2 changed files with 20 additions and 20 deletions

View file

@ -255,7 +255,7 @@ run_all_tests() {
# Reset and create a fresh container to work with # Reset and create a fresh container to work with
check_lxd_setup check_lxd_setup
LXC_RESET LXC_RESET
LXC_CREATE ynh_lxc_pc_create
# Be sure that the container is running # Be sure that the container is running
ynh_lxc_pc_exec "true" ynh_lxc_pc_exec "true"

View file

@ -67,10 +67,7 @@ ynh_lxc_pc_witness_files_set () {
echo "CREATE DATABASE witnessdb" | RUN_INSIDE_LXC mysql --wait > /dev/null 2>&1 echo "CREATE DATABASE witnessdb" | RUN_INSIDE_LXC mysql --wait > /dev/null 2>&1
} }
ynh_lxc_pc_witness_files_check () { ynh_lxc_pc_witness_file_check () {
# Check all the witness files, to verify if them still here
check_file_exist () {
if RUN_INSIDE_LXC test ! -e "$1" if RUN_INSIDE_LXC test ! -e "$1"
then then
log_error "The file $1 is missing ! Something gone wrong !" log_error "The file $1 is missing ! Something gone wrong !"
@ -78,33 +75,36 @@ ynh_lxc_pc_witness_files_check () {
fi fi
} }
ynh_lxc_pc_witness_files_check () {
# Check all the witness files, to verify if them still here
# Nginx conf # Nginx conf
check_file_exist "/etc/nginx/conf.d/$DOMAIN.d/witnessfile.conf" ynh_lxc_pc_witness_file_check "/etc/nginx/conf.d/$DOMAIN.d/witnessfile.conf"
check_file_exist "/etc/nginx/conf.d/$SUBDOMAIN.d/witnessfile.conf" ynh_lxc_pc_witness_file_check "/etc/nginx/conf.d/$SUBDOMAIN.d/witnessfile.conf"
# /etc # /etc
check_file_exist "/etc/witnessfile" ynh_lxc_pc_witness_file_check "/etc/witnessfile"
# /opt directory # /opt directory
check_file_exist "/opt/witnessdir" ynh_lxc_pc_witness_file_check "/opt/witnessdir"
# /var/www directory # /var/www directory
check_file_exist "/var/www/witnessdir" ynh_lxc_pc_witness_file_check "/var/www/witnessdir"
# /home/yunohost.app/ # /home/yunohost.app/
check_file_exist "/home/yunohost.app/witnessdir" ynh_lxc_pc_witness_file_check "/home/yunohost.app/witnessdir"
# /var/log # /var/log
check_file_exist "/var/log/witnessfile" ynh_lxc_pc_witness_file_check "/var/log/witnessfile"
# Config fpm # Config fpm
check_file_exist "/etc/php/$DEFAULT_PHP_VERSION/fpm/pool.d/witnessfile.conf" ynh_lxc_pc_witness_file_check "/etc/php/$DEFAULT_PHP_VERSION/fpm/pool.d/witnessfile.conf"
# Config logrotate # Config logrotate
check_file_exist "/etc/logrotate.d/witnessfile" ynh_lxc_pc_witness_file_check "/etc/logrotate.d/witnessfile"
# Config systemd # Config systemd
check_file_exist "/etc/systemd/system/witnessfile.service" ynh_lxc_pc_witness_file_check "/etc/systemd/system/witnessfile.service"
# Database # Database
if ! RUN_INSIDE_LXC mysqlshow witnessdb > /dev/null 2>&1 if ! RUN_INSIDE_LXC mysqlshow witnessdb > /dev/null 2>&1
@ -115,7 +115,7 @@ ynh_lxc_pc_witness_files_check () {
fi fi
} }
LXC_CREATE () { ynh_lxc_pc_create () {
log_info "Launching new LXC $LXC_NAME ..." log_info "Launching new LXC $LXC_NAME ..."
# Check if we can launch container from YunoHost remote image # Check if we can launch container from YunoHost remote image
if lxc remote list | grep -q "yunohost" && lxc image list yunohost:$LXC_BASE | grep -q -w $LXC_BASE; then if lxc remote list | grep -q "yunohost" && lxc image list yunohost:$LXC_BASE | grep -q -w $LXC_BASE; then