mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
Do not display the timer for small operations
This commit is contained in:
parent
c1af081c58
commit
2772b2feaf
2 changed files with 15 additions and 13 deletions
|
@ -123,7 +123,7 @@ use_temp_snapshot () {
|
||||||
# Restore this snapshot.
|
# Restore this snapshot.
|
||||||
sudo rsync --acls --archive --delete --executability --itemize-changes --xattrs "$snapshot_path/$current_snapshot/rootfs/" "/var/lib/lxc/$lxc_name/rootfs/" > /dev/null 2>> "$test_result"
|
sudo rsync --acls --archive --delete --executability --itemize-changes --xattrs "$snapshot_path/$current_snapshot/rootfs/" "/var/lib/lxc/$lxc_name/rootfs/" > /dev/null 2>> "$test_result"
|
||||||
|
|
||||||
stop_timer 1
|
stop_timer 1 >> "$complete_log"
|
||||||
|
|
||||||
# Retrieve the app id in the log. To manage the app after
|
# Retrieve the app id in the log. To manage the app after
|
||||||
ynh_app_id=$(sudo tac "$yunohost_log" | grep --only-matching --max-count=1 "YNH_APP_INSTANCE_NAME=[^ ]*" | cut --delimiter='=' --fields=2)
|
ynh_app_id=$(sudo tac "$yunohost_log" | grep --only-matching --max-count=1 "YNH_APP_INSTANCE_NAME=[^ ]*" | cut --delimiter='=' --fields=2)
|
||||||
|
@ -176,11 +176,11 @@ LXC_START () {
|
||||||
# Start the container and log the booting process in $script_dir/lxc_boot.log
|
# Start the container and log the booting process in $script_dir/lxc_boot.log
|
||||||
# Try to start only if the container is not already started
|
# Try to start only if the container is not already started
|
||||||
if ! is_lxc_running; then
|
if ! is_lxc_running; then
|
||||||
echo -n "Start the LXC container" | tee --append "$test_result"
|
echo -n "Start the LXC container" >> "$test_result"
|
||||||
sudo lxc-start --name=$lxc_name --daemon --logfile "$script_dir/lxc_boot.log" | tee --append "$test_result" 2>&1
|
sudo lxc-start --name=$lxc_name --daemon --logfile "$script_dir/lxc_boot.log" | tee --append "$test_result" 2>&1
|
||||||
local avoid_witness=0
|
local avoid_witness=0
|
||||||
else
|
else
|
||||||
echo -n "A LXC container is already running" | tee --append "$test_result"
|
echo -n "A LXC container is already running" >> "$test_result"
|
||||||
local avoid_witness=1
|
local avoid_witness=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ $(cat "$script_dir/sub_scripts/Build_lxc.log")"
|
||||||
local lxc_check_result="An error has happened with the host. Please check the configuration."
|
local lxc_check_result="An error has happened with the host. Please check the configuration."
|
||||||
ECHO_FORMAT "$lxc_check_result\n" "red" "bold"
|
ECHO_FORMAT "$lxc_check_result\n" "red" "bold"
|
||||||
send_email
|
send_email
|
||||||
stop_timer 1
|
stop_timer 1 >> "$complete_log"
|
||||||
return 1
|
return 1
|
||||||
elif [ $lxc_check -eq 2 ]; then
|
elif [ $lxc_check -eq 2 ]; then
|
||||||
local lxc_check_result="The container is broken, it will be rebuilt."
|
local lxc_check_result="The container is broken, it will be rebuilt."
|
||||||
|
@ -289,7 +289,7 @@ $(cat "$script_dir/sub_scripts/Build_lxc.log")"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
stop_timer 1
|
stop_timer 1 >> "$complete_log"
|
||||||
start_timer
|
start_timer
|
||||||
|
|
||||||
# Count the number of lines of the current yunohost log file.
|
# Count the number of lines of the current yunohost log file.
|
||||||
|
@ -323,7 +323,7 @@ $(cat "$script_dir/sub_scripts/Build_lxc.log")"
|
||||||
# Retrieve the log of the previous command and copy its content in the temporary log
|
# Retrieve the log of the previous command and copy its content in the temporary log
|
||||||
sudo cat "/var/lib/lxc/$lxc_name/rootfs/home/pchecker/temp_yunohost-cli.log" >> "$temp_log"
|
sudo cat "/var/lib/lxc/$lxc_name/rootfs/home/pchecker/temp_yunohost-cli.log" >> "$temp_log"
|
||||||
|
|
||||||
stop_timer 1
|
stop_timer 1 >> "$complete_log"
|
||||||
# Return the exit code of the ssh command
|
# Return the exit code of the ssh command
|
||||||
return $returncode
|
return $returncode
|
||||||
}
|
}
|
||||||
|
@ -356,7 +356,7 @@ LXC_STOP () {
|
||||||
# Restore the snapshot.
|
# Restore the snapshot.
|
||||||
echo "Restore the previous snapshot." | tee --append "$test_result"
|
echo "Restore the previous snapshot." | tee --append "$test_result"
|
||||||
sudo rsync --acls --archive --delete --executability --itemize-changes --xattrs "$snapshot_path/$current_snapshot/rootfs/" "/var/lib/lxc/$lxc_name/rootfs/" > /dev/null 2>> "$test_result"
|
sudo rsync --acls --archive --delete --executability --itemize-changes --xattrs "$snapshot_path/$current_snapshot/rootfs/" "/var/lib/lxc/$lxc_name/rootfs/" > /dev/null 2>> "$test_result"
|
||||||
stop_timer 1
|
stop_timer 1 >> "$complete_log"
|
||||||
}
|
}
|
||||||
|
|
||||||
LXC_TURNOFF () {
|
LXC_TURNOFF () {
|
||||||
|
|
|
@ -122,14 +122,14 @@ STANDARD_SETUP_APP () {
|
||||||
# Check if a snapshot already exist for a root install
|
# Check if a snapshot already exist for a root install
|
||||||
if [ -z "$root_snapshot" ]
|
if [ -z "$root_snapshot" ]
|
||||||
then
|
then
|
||||||
ECHO_FORMAT "\nCreate a snapshot for root installation.\n" "white" clog
|
ECHO_FORMAT "\nCreate a snapshot for root installation.\n" "white" clog >> $complete_log
|
||||||
create_temp_backup 2
|
create_temp_backup 2
|
||||||
root_snapshot=snap2
|
root_snapshot=snap2
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Or uses an existing snapshot
|
# Or uses an existing snapshot
|
||||||
ECHO_FORMAT "Uses an existing snapshot for root installation.\n" "white" clog
|
ECHO_FORMAT "Uses an existing snapshot for root installation.\n" "white" clog >> $complete_log
|
||||||
use_temp_snapshot $root_snapshot
|
use_temp_snapshot $root_snapshot
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -148,14 +148,14 @@ STANDARD_SETUP_APP () {
|
||||||
# Check if a snapshot already exist for a subpath (or no_url) install
|
# Check if a snapshot already exist for a subpath (or no_url) install
|
||||||
if [ -z "$subpath_snapshot" ]
|
if [ -z "$subpath_snapshot" ]
|
||||||
then
|
then
|
||||||
ECHO_FORMAT "\nCreate a snapshot for sub path installation.\n" "white" clog
|
ECHO_FORMAT "\nCreate a snapshot for sub path installation.\n" "white" clog >> $complete_log
|
||||||
create_temp_backup 1
|
create_temp_backup 1
|
||||||
root_snapshot=snap1
|
root_snapshot=snap1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Or uses an existing snapshot
|
# Or uses an existing snapshot
|
||||||
ECHO_FORMAT "Uses an existing snapshot for sub path installation.\n" "white" clog
|
ECHO_FORMAT "Uses an existing snapshot for sub path installation.\n" "white" clog >> $complete_log
|
||||||
use_temp_snapshot $subpath_snapshot
|
use_temp_snapshot $subpath_snapshot
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -444,7 +444,9 @@ unit_test_title () {
|
||||||
# Print a title for the test
|
# Print a title for the test
|
||||||
# $1 = Name of the test
|
# $1 = Name of the test
|
||||||
|
|
||||||
ECHO_FORMAT "\n\n>> $1 [Test $cur_test/$all_test]\n" "white" "bold" clog
|
ECHO_FORMAT "\n\n##########################################\n" "white" "bold" clog
|
||||||
|
ECHO_FORMAT "# >> $1 [Test $cur_test/$all_test]\n" "white" "bold" clog
|
||||||
|
ECHO_FORMAT "##########################################\n" "white" "bold" clog
|
||||||
|
|
||||||
# Increment the value of the current test
|
# Increment the value of the current test
|
||||||
cur_test=$((cur_test+1))
|
cur_test=$((cur_test+1))
|
||||||
|
@ -1894,7 +1896,7 @@ TEST_LAUNCHER () {
|
||||||
|
|
||||||
set_witness_files () {
|
set_witness_files () {
|
||||||
# Create files to check if the remove script does not remove them accidentally
|
# Create files to check if the remove script does not remove them accidentally
|
||||||
echo "Create witness files..." | tee --append "$test_result"
|
echo "Create witness files..." >> "$test_result"
|
||||||
|
|
||||||
lxc_dir="/var/lib/lxc/$lxc_name/rootfs"
|
lxc_dir="/var/lib/lxc/$lxc_name/rootfs"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue