Various corrections

This commit is contained in:
Adrien Ferrand 2019-10-20 22:59:45 +02:00
parent e166c3222e
commit 836c80428d
3 changed files with 17 additions and 41 deletions

View file

@ -1181,7 +1181,6 @@ if [ "$1" = "--le-auto-phase2" ]; then
error "Skipping upgrade because new OS dependencies may need to be installed."
error "This requires a manual user intervention."
error "$INTERACTIVE_BOOTSTRAP_MESSAGE"
error
# If this is because of the environment (eg. non interactive shell without
# --non-interactive flag set), help the user in that direction.
else

View file

@ -601,7 +601,6 @@ if [ "$1" = "--le-auto-phase2" ]; then
error "Skipping upgrade because new OS dependencies may need to be installed."
error "This requires a manual user intervention."
error "$INTERACTIVE_BOOTSTRAP_MESSAGE"
error
# If this is because of the environment (eg. non interactive shell without
# --non-interactive flag set), help the user in that direction.
else

View file

@ -5,9 +5,6 @@ yum update -y >/dev/null
LE_AUTO_PY_34="certbot/letsencrypt-auto-source/letsencrypt-auto_py_34"
LE_AUTO="certbot/letsencrypt-auto-source/letsencrypt-auto"
# Last version of certbot-auto that was bootstraping Python 3.4 for CentOS 6 users
INITIAL_CERTBOT_VERSION_PY34="certbot 0.38.0"
# Check bootstrap from current letsencrypt-auto will fail, because SCL is not enabled.
if ! "$LE_AUTO" 2>&1 | grep -q "Enable the SCL repository and try running Certbot again."; then
echo "ERROR: bootstrap was not aborted although SCL was not installed!"
@ -29,53 +26,34 @@ fi
echo "PASSED: bootstrap from old letsencrypt-auto succeeded and installed Python 3.4"
# Expect letsencrypt-auto to just fail to rebootstrap and start certbot in interactive
# shell since SCL is not installed.
if ! "$LE_AUTO" --version 2>&1 | grep -q "Enable the SCL repository and try running Certbot again."; then
# Expect letsencrypt-auto to skip rebootstrapping with a warning since SCL is not installed.
if ! "$LE_AUTO" --non-interactive --version 2>&1 | grep -q "Enable the SCL repository and try running Certbot again."; then
echo "FAILED: Script letsencrypt-auto managed to start Certbot in interactive shell while SCL is not enabled!"
exit 1
fi
echo "PASSED: Script letsencrypt-auto did not rebootstrap."
# Expect letsencrypt-auto to not update certbot, but start it anyway in non-interactive
# shell since SCL is not installed.
# NB: Readline has an issue on all Python versions for OL 6, making `certbot --version`
# output an unprintable ASCII character on a new line at the end.
# So we take the second last line of the output.
version=$($LE_AUTO --version 2>/dev/null | tail -2 | head -1)
if [ -z "$version" ]; then
echo "ERROR: Script letsencrypt-auto failed to start certbot in a non-interactive shell while SCL was not enabled."
exit 1
fi
if [ "$version" != "$INITIAL_CERTBOT_VERSION_PY34" ]; then
echo "ERROR: Script letsencrypt-auto upgraded certbot in a non-interactive shell while SCL was not enabled."
exit 1
fi
echo "PASSED: Script letsencrypt-auto did not upgrade certbot but started it successfully while SCL was not enabled."
# Enable SCL
yum install -y oracle-softwarecollection-release-el6 >/dev/null
# Following test is exectued in a subshell, to not leak any environment variable
(
export VENV_PATH=$(mktemp -d)
# Expect letsencrypt-auto to bootstrap successfully since SCL is available
"$LE_AUTO" -n >/dev/null 2>/dev/null
if [ "$($VENV_PATH/bin/python -V 2>&1 | cut -d" " -f2 | cut -d. -f1-2)" != "3.6" ]; then
echo "ERROR: Script letsencrypt-auto failed to bootstrap and install Python 3.6 while SCL is available."
# Expect letsencrypt-auto to bootstrap successfully since SCL is available,
# assert that there is no output since --quiet flag is set.
OUTPUT_LEN=$("$LE_AUTO" -n --quiet 2>&1 | wc -c)
if [ "$OUTPUT_LEN" != 0 ]; then
echo letsencrypt-auto produced unexpected output!
exit 1
fi
fi
if ! $VENV_PATH/bin/certbot --version > /dev/null 2> /dev/null; then
echo "ERROR: Script letsencrypt-auto did not install certbot correctly while SCL is enabled."
exit 1
fi
)
if [ "$(/opt/eff.org/bin/python -V 2>&1 | cut -d" " -f2 | cut -d. -f1-2)" != "3.6" ]; then
echo "ERROR: Script letsencrypt-auto failed to bootstrap and install Python 3.6 while SCL is available."
exit 1
fi
if ! /opt/eff.org/bin/certbot --version > /dev/null 2> /dev/null; then
echo "ERROR: Script letsencrypt-auto did not install certbot correctly while SCL is enabled."
exit 1
fi
echo "PASSED: Script letsencrypt-auto correctly bootstraped Certbot using rh-python36 when SCL is available."