mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
Implement ynh_lxc_pc_witness_files_check
This commit is contained in:
parent
7a736218de
commit
28c7be085a
2 changed files with 27 additions and 14 deletions
|
@ -18,7 +18,7 @@ _RUN_YUNOHOST_CMD() {
|
||||||
| grep --line-buffered -v 'processing action'
|
| grep --line-buffered -v 'processing action'
|
||||||
|
|
||||||
returncode=${PIPESTATUS[0]}
|
returncode=${PIPESTATUS[0]}
|
||||||
ynh_lxc_pc_witness_files_check && return $returncode || return 2
|
ynh_lxc_pc_witness_files_check --name=$LXC_NAME && return $returncode || return 2
|
||||||
}
|
}
|
||||||
|
|
||||||
_PREINSTALL () {
|
_PREINSTALL () {
|
||||||
|
|
|
@ -132,39 +132,52 @@ ynh_lxc_pc_witness_file_check () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
ynh_lxc_pc_witness_files_check () {
|
# Check witness in an LXC container
|
||||||
|
#
|
||||||
|
# usage: ynh_lxc_pc_witness_files_check --name=$LXC_NAME --name=name
|
||||||
|
# | arg: -n, --name= - name of the LXC
|
||||||
|
#
|
||||||
|
# Requires YunoHost version *.*.* or higher.
|
||||||
|
ynh_lxc_pc_witness_files_check --name=$LXC_NAME () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=n
|
||||||
|
local -A args_array=([n]=name=)
|
||||||
|
local name
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
# Check all the witness files, to verify if them still here
|
# Check all the witness files, to verify if them still here
|
||||||
|
|
||||||
# Nginx conf
|
# Nginx conf
|
||||||
ynh_lxc_pc_witness_file_check --name=$LXC_NAME --witness="/etc/nginx/conf.d/$DOMAIN.d/witnessfile.conf"
|
ynh_lxc_pc_witness_file_check --name=$name --witness="/etc/nginx/conf.d/$DOMAIN.d/witnessfile.conf"
|
||||||
ynh_lxc_pc_witness_file_check --name=$LXC_NAME --witness="/etc/nginx/conf.d/$SUBDOMAIN.d/witnessfile.conf"
|
ynh_lxc_pc_witness_file_check --name=$name --witness="/etc/nginx/conf.d/$SUBDOMAIN.d/witnessfile.conf"
|
||||||
|
|
||||||
# /etc
|
# /etc
|
||||||
ynh_lxc_pc_witness_file_check --name=$LXC_NAME --witness="/etc/witnessfile"
|
ynh_lxc_pc_witness_file_check --name=$name --witness="/etc/witnessfile"
|
||||||
|
|
||||||
# /opt directory
|
# /opt directory
|
||||||
ynh_lxc_pc_witness_file_check --name=$LXC_NAME --witness="/opt/witnessdir"
|
ynh_lxc_pc_witness_file_check --name=$name --witness="/opt/witnessdir"
|
||||||
|
|
||||||
# /var/www directory
|
# /var/www directory
|
||||||
ynh_lxc_pc_witness_file_check --name=$LXC_NAME --witness="/var/www/witnessdir"
|
ynh_lxc_pc_witness_file_check --name=$name --witness="/var/www/witnessdir"
|
||||||
|
|
||||||
# /home/yunohost.app/
|
# /home/yunohost.app/
|
||||||
ynh_lxc_pc_witness_file_check --name=$LXC_NAME --witness="/home/yunohost.app/witnessdir"
|
ynh_lxc_pc_witness_file_check --name=$name --witness="/home/yunohost.app/witnessdir"
|
||||||
|
|
||||||
# /var/log
|
# /var/log
|
||||||
ynh_lxc_pc_witness_file_check --name=$LXC_NAME --witness="/var/log/witnessfile"
|
ynh_lxc_pc_witness_file_check --name=$name --witness="/var/log/witnessfile"
|
||||||
|
|
||||||
# Config fpm
|
# Config fpm
|
||||||
ynh_lxc_pc_witness_file_check --name=$LXC_NAME --witness="/etc/php/$DEFAULT_PHP_VERSION/fpm/pool.d/witnessfile.conf"
|
ynh_lxc_pc_witness_file_check --name=$name --witness="/etc/php/$DEFAULT_PHP_VERSION/fpm/pool.d/witnessfile.conf"
|
||||||
|
|
||||||
# Config logrotate
|
# Config logrotate
|
||||||
ynh_lxc_pc_witness_file_check --name=$LXC_NAME --witness="/etc/logrotate.d/witnessfile"
|
ynh_lxc_pc_witness_file_check --name=$name --witness="/etc/logrotate.d/witnessfile"
|
||||||
|
|
||||||
# Config systemd
|
# Config systemd
|
||||||
ynh_lxc_pc_witness_file_check --name=$LXC_NAME --witness="/etc/systemd/system/witnessfile.service"
|
ynh_lxc_pc_witness_file_check --name=$name --witness="/etc/systemd/system/witnessfile.service"
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
if ! ynh_lxc_run_inside --name=$LXC_NAME --command="mysqlshow witnessdb > /dev/null 2>&1"
|
if ! ynh_lxc_run_inside --name=$name --command="mysqlshow witnessdb > /dev/null 2>&1"
|
||||||
then
|
then
|
||||||
log_error "The database witnessdb is missing ! Something gone wrong !"
|
log_error "The database witnessdb is missing ! Something gone wrong !"
|
||||||
SET_RESULT "failure" witness
|
SET_RESULT "failure" witness
|
||||||
|
@ -213,7 +226,7 @@ ynh_lxc_pc_snapshot_create () {
|
||||||
start_timer
|
start_timer
|
||||||
|
|
||||||
# Check all the witness files, to verify if them still here
|
# Check all the witness files, to verify if them still here
|
||||||
ynh_lxc_pc_witness_files_check >&2
|
ynh_lxc_pc_witness_files_check --name=$LXC_NAME >&2
|
||||||
|
|
||||||
# Remove swap files to avoid killing the CI with huge snapshots.
|
# Remove swap files to avoid killing the CI with huge snapshots.
|
||||||
ynh_lxc_swapfiles_clean
|
ynh_lxc_swapfiles_clean
|
||||||
|
|
Loading…
Add table
Reference in a new issue