Fix error in case of some creation of certificates failed and some are successfully created.

This commit is contained in:
Christoph 2021-08-01 14:35:48 +02:00
parent a18e78957d
commit 3bca2aca0a

View File

@ -1800,8 +1800,10 @@ fi
\$dehydrated_script -c -g > \$_logfile 2>&1 \$dehydrated_script -c -g > \$_logfile 2>&1
ret_val=\$? ret_val=\$?
if [[ \$ret_val -eq 0 ]]; then if [[ \$ret_val -eq 0 ]]; then
_successfully_finished_script=true
\$verbose && echo_ok \$verbose && echo_ok
else else
_successfully_finished_script=false
\$verbose && echo_failed \$verbose && echo_failed
if \$verbose ; then if \$verbose ; then
error "Dehydrated Script returns with error (\$ret_val)!" error "Dehydrated Script returns with error (\$ret_val)!"
@ -1809,12 +1811,6 @@ else
echo -e "\\n [ Error ]: Dehydrated Script returns with error (\$ret_val)! \\n" echo -e "\\n [ Error ]: Dehydrated Script returns with error (\$ret_val)! \\n"
fi fi
echo "" echo ""
echo "Error message from dehydrated script:"
echo "====================================="
echo ""
cat \$_logfile
echo ""
exit 10
fi fi
@ -2395,7 +2391,7 @@ fi
# - Nothing to do if al is up tp date # - Nothing to do if al is up tp date
# - # -
#if ! \$certs_updated && ! grep -q -i "error:" \$_logfile 2> /dev/null ; then #if ! \$certs_updated && ! grep -q -i "error:" \$_logfile 2> /dev/null ; then
if ! \$certs_updated && ! \$certs_processed ; then if ! \$certs_updated && ! \$certs_processed && \$_successfully_finished_script ; then
if \$verbose ; then if \$verbose ; then
info "All Certificates are up to date." info "All Certificates are up to date."
@ -2644,21 +2640,6 @@ if \$certs_updated ; then
fi fi
fi fi
if [[ -n "\$_successfully_created_hosts" ]] ; then
echo ""
echo ""
echo "Certificates successfully created:"
echo "=================================="
echo ""
for _hostname in \$_successfully_created_hosts ; do
echo " https://\$_hostname"
done
echo ""
fi
if [[ -n "\$_invalid_challenge" ]] ; then if [[ -n "\$_invalid_challenge" ]] ; then
echo "" echo ""
@ -2689,6 +2670,21 @@ if [[ -n "\$_http_request_failed" ]] ; then
echo "" echo ""
fi fi
if [[ -n "\$_successfully_created_hosts" ]] ; then
echo ""
echo ""
echo "Certificates successfully created:"
echo "=================================="
echo ""
for _hostname in \$_successfully_created_hosts ; do
echo " https://\$_hostname"
done
echo ""
fi
if [[ -n "\$_too_many_certs_err_msg" ]] ; then if [[ -n "\$_too_many_certs_err_msg" ]] ; then
echo "" echo ""
echo "" echo ""
@ -2700,7 +2696,7 @@ if [[ -n "\$_too_many_certs_err_msg" ]] ; then
fi fi
if grep -i "error:" \$_logfile > /dev/null 2>&1 || grep -i "$ERR_MSG_TOO_MANY_CERTS" \$_logfile > /dev/null 2>&1 ; then if ! \$_successfully_finished_script || grep -i "error:" \$_logfile > /dev/null 2>&1 || grep -i "$ERR_MSG_TOO_MANY_CERTS" \$_logfile > /dev/null 2>&1 ; then
cp -a \$_logfile /var/log/ > /dev/null 2>&1 cp -a \$_logfile /var/log/ > /dev/null 2>&1