Skip to content

Commit e5113d5

Browse files
committed
Undo certbot-auto changes and remove centos6 tests
* Don't deprecate certbot-auto quite yet * Remove centos6 test farm tests * undo changes to test farm test scripts
1 parent ff3a07d commit e5113d5

6 files changed

Lines changed: 287 additions & 37 deletions

File tree

letsencrypt-auto-source/letsencrypt-auto

Lines changed: 104 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,8 +794,110 @@ BootstrapMageiaCommon() {
794794
}
795795

796796

797-
# Certbot-auto is now fully deprecated
798-
DEPRECATED_OS=1
797+
# Set Bootstrap to the function that installs OS dependencies on this system
798+
# and BOOTSTRAP_VERSION to the unique identifier for the current version of
799+
# that function. If Bootstrap is set to a function that doesn't install any
800+
# packages BOOTSTRAP_VERSION is not set.
801+
if [ -f /etc/debian_version ]; then
802+
DEPRECATED_OS=1
803+
elif [ -f /etc/mageia-release ]; then
804+
# Mageia has both /etc/mageia-release and /etc/redhat-release
805+
DEPRECATED_OS=1
806+
elif [ -f /etc/redhat-release ]; then
807+
# Run DeterminePythonVersion to decide on the basis of available Python versions
808+
# whether to use 2.x or 3.x on RedHat-like systems.
809+
# Then, revert LE_PYTHON to its previous state.
810+
prev_le_python="$LE_PYTHON"
811+
unset LE_PYTHON
812+
DeterminePythonVersion "NOCRASH"
813+
814+
RPM_DIST_NAME=`(. /etc/os-release 2> /dev/null && echo $ID) || echo "unknown"`
815+
816+
if [ "$PYVER" -eq 26 -a $(uname -m) != 'x86_64' ]; then
817+
# 32 bits CentOS 6 and affiliates are not supported anymore by certbot-auto.
818+
DEPRECATED_OS=1
819+
fi
820+
821+
# Set RPM_DIST_VERSION to VERSION_ID from /etc/os-release after splitting on
822+
# '.' characters (e.g. "8.0" becomes "8"). If the command exits with an
823+
# error, RPM_DIST_VERSION is set to "unknown".
824+
RPM_DIST_VERSION=$( (. /etc/os-release 2> /dev/null && echo "$VERSION_ID") | cut -d '.' -f1 || echo "unknown")
825+
826+
# If RPM_DIST_VERSION is an empty string or it contains any nonnumeric
827+
# characters, the value is unexpected so we set RPM_DIST_VERSION to 0.
828+
if [ -z "$RPM_DIST_VERSION" ] || [ -n "$(echo "$RPM_DIST_VERSION" | tr -d '[0-9]')" ]; then
829+
RPM_DIST_VERSION=0
830+
fi
831+
832+
# Handle legacy RPM distributions
833+
if [ "$PYVER" -eq 26 ]; then
834+
# Check if an automated bootstrap can be achieved on this system.
835+
if ! Python36SclIsAvailable; then
836+
INTERACTIVE_BOOTSTRAP=1
837+
fi
838+
839+
Bootstrap() {
840+
BootstrapMessage "Legacy RedHat-based OSes that will use Python3"
841+
BootstrapRpmPython3Legacy
842+
}
843+
USE_PYTHON_3=1
844+
BOOTSTRAP_VERSION="BootstrapRpmPython3Legacy $BOOTSTRAP_RPM_PYTHON3_LEGACY_VERSION"
845+
846+
# Try now to enable SCL rh-python36 for systems already bootstrapped
847+
# NB: EnablePython36SCL has been defined along with BootstrapRpmPython3Legacy in certbot-auto
848+
EnablePython36SCL
849+
else
850+
# Starting to Fedora 29, python2 is on a deprecation path. Let's move to python3 then.
851+
# RHEL 8 also uses python3 by default.
852+
if [ "$RPM_DIST_NAME" = "fedora" -a "$RPM_DIST_VERSION" -ge 29 ]; then
853+
RPM_USE_PYTHON_3=1
854+
elif [ "$RPM_DIST_NAME" = "rhel" -a "$RPM_DIST_VERSION" -ge 8 ]; then
855+
RPM_USE_PYTHON_3=1
856+
elif [ "$RPM_DIST_NAME" = "centos" -a "$RPM_DIST_VERSION" -ge 8 ]; then
857+
RPM_USE_PYTHON_3=1
858+
else
859+
RPM_USE_PYTHON_3=0
860+
fi
861+
862+
if [ "$RPM_USE_PYTHON_3" = 1 ]; then
863+
Bootstrap() {
864+
BootstrapMessage "RedHat-based OSes that will use Python3"
865+
BootstrapRpmPython3
866+
}
867+
USE_PYTHON_3=1
868+
BOOTSTRAP_VERSION="BootstrapRpmPython3 $BOOTSTRAP_RPM_PYTHON3_VERSION"
869+
else
870+
Bootstrap() {
871+
BootstrapMessage "RedHat-based OSes"
872+
BootstrapRpmCommon
873+
}
874+
BOOTSTRAP_VERSION="BootstrapRpmCommon $BOOTSTRAP_RPM_COMMON_VERSION"
875+
fi
876+
fi
877+
878+
LE_PYTHON="$prev_le_python"
879+
elif [ -f /etc/os-release ] && `grep -q openSUSE /etc/os-release` ; then
880+
DEPRECATED_OS=1
881+
elif [ -f /etc/arch-release ]; then
882+
DEPRECATED_OS=1
883+
elif [ -f /etc/manjaro-release ]; then
884+
DEPRECATED_OS=1
885+
elif [ -f /etc/gentoo-release ]; then
886+
DEPRECATED_OS=1
887+
elif uname | grep -iq FreeBSD ; then
888+
DEPRECATED_OS=1
889+
elif uname | grep -iq Darwin ; then
890+
DEPRECATED_OS=1
891+
elif [ -f /etc/issue ] && grep -iq "Amazon Linux" /etc/issue ; then
892+
Bootstrap() {
893+
ExperimentalBootstrap "Amazon Linux" BootstrapRpmCommon
894+
}
895+
BOOTSTRAP_VERSION="BootstrapRpmCommon $BOOTSTRAP_RPM_COMMON_VERSION"
896+
elif [ -f /etc/product ] && grep -q "Joyent Instance" /etc/product ; then
897+
DEPRECATED_OS=1
898+
else
899+
DEPRECATED_OS=1
900+
fi
799901

800902
# We handle this case after determining the normal bootstrap version to allow
801903
# variables like USE_PYTHON_3 to be properly set. As described above, if the

letsencrypt-auto-source/letsencrypt-auto.template

Lines changed: 104 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,110 @@ DeterminePythonVersion() {
316316
{{ bootstrappers/smartos.sh }}
317317
{{ bootstrappers/mageia_common.sh }}
318318

319-
# Certbot-auto is now fully deprecated
320-
DEPRECATED_OS=1
319+
# Set Bootstrap to the function that installs OS dependencies on this system
320+
# and BOOTSTRAP_VERSION to the unique identifier for the current version of
321+
# that function. If Bootstrap is set to a function that doesn't install any
322+
# packages BOOTSTRAP_VERSION is not set.
323+
if [ -f /etc/debian_version ]; then
324+
DEPRECATED_OS=1
325+
elif [ -f /etc/mageia-release ]; then
326+
# Mageia has both /etc/mageia-release and /etc/redhat-release
327+
DEPRECATED_OS=1
328+
elif [ -f /etc/redhat-release ]; then
329+
# Run DeterminePythonVersion to decide on the basis of available Python versions
330+
# whether to use 2.x or 3.x on RedHat-like systems.
331+
# Then, revert LE_PYTHON to its previous state.
332+
prev_le_python="$LE_PYTHON"
333+
unset LE_PYTHON
334+
DeterminePythonVersion "NOCRASH"
335+
336+
RPM_DIST_NAME=`(. /etc/os-release 2> /dev/null && echo $ID) || echo "unknown"`
337+
338+
if [ "$PYVER" -eq 26 -a $(uname -m) != 'x86_64' ]; then
339+
# 32 bits CentOS 6 and affiliates are not supported anymore by certbot-auto.
340+
DEPRECATED_OS=1
341+
fi
342+
343+
# Set RPM_DIST_VERSION to VERSION_ID from /etc/os-release after splitting on
344+
# '.' characters (e.g. "8.0" becomes "8"). If the command exits with an
345+
# error, RPM_DIST_VERSION is set to "unknown".
346+
RPM_DIST_VERSION=$( (. /etc/os-release 2> /dev/null && echo "$VERSION_ID") | cut -d '.' -f1 || echo "unknown")
347+
348+
# If RPM_DIST_VERSION is an empty string or it contains any nonnumeric
349+
# characters, the value is unexpected so we set RPM_DIST_VERSION to 0.
350+
if [ -z "$RPM_DIST_VERSION" ] || [ -n "$(echo "$RPM_DIST_VERSION" | tr -d '[0-9]')" ]; then
351+
RPM_DIST_VERSION=0
352+
fi
353+
354+
# Handle legacy RPM distributions
355+
if [ "$PYVER" -eq 26 ]; then
356+
# Check if an automated bootstrap can be achieved on this system.
357+
if ! Python36SclIsAvailable; then
358+
INTERACTIVE_BOOTSTRAP=1
359+
fi
360+
361+
Bootstrap() {
362+
BootstrapMessage "Legacy RedHat-based OSes that will use Python3"
363+
BootstrapRpmPython3Legacy
364+
}
365+
USE_PYTHON_3=1
366+
BOOTSTRAP_VERSION="BootstrapRpmPython3Legacy $BOOTSTRAP_RPM_PYTHON3_LEGACY_VERSION"
367+
368+
# Try now to enable SCL rh-python36 for systems already bootstrapped
369+
# NB: EnablePython36SCL has been defined along with BootstrapRpmPython3Legacy in certbot-auto
370+
EnablePython36SCL
371+
else
372+
# Starting to Fedora 29, python2 is on a deprecation path. Let's move to python3 then.
373+
# RHEL 8 also uses python3 by default.
374+
if [ "$RPM_DIST_NAME" = "fedora" -a "$RPM_DIST_VERSION" -ge 29 ]; then
375+
RPM_USE_PYTHON_3=1
376+
elif [ "$RPM_DIST_NAME" = "rhel" -a "$RPM_DIST_VERSION" -ge 8 ]; then
377+
RPM_USE_PYTHON_3=1
378+
elif [ "$RPM_DIST_NAME" = "centos" -a "$RPM_DIST_VERSION" -ge 8 ]; then
379+
RPM_USE_PYTHON_3=1
380+
else
381+
RPM_USE_PYTHON_3=0
382+
fi
383+
384+
if [ "$RPM_USE_PYTHON_3" = 1 ]; then
385+
Bootstrap() {
386+
BootstrapMessage "RedHat-based OSes that will use Python3"
387+
BootstrapRpmPython3
388+
}
389+
USE_PYTHON_3=1
390+
BOOTSTRAP_VERSION="BootstrapRpmPython3 $BOOTSTRAP_RPM_PYTHON3_VERSION"
391+
else
392+
Bootstrap() {
393+
BootstrapMessage "RedHat-based OSes"
394+
BootstrapRpmCommon
395+
}
396+
BOOTSTRAP_VERSION="BootstrapRpmCommon $BOOTSTRAP_RPM_COMMON_VERSION"
397+
fi
398+
fi
399+
400+
LE_PYTHON="$prev_le_python"
401+
elif [ -f /etc/os-release ] && `grep -q openSUSE /etc/os-release` ; then
402+
DEPRECATED_OS=1
403+
elif [ -f /etc/arch-release ]; then
404+
DEPRECATED_OS=1
405+
elif [ -f /etc/manjaro-release ]; then
406+
DEPRECATED_OS=1
407+
elif [ -f /etc/gentoo-release ]; then
408+
DEPRECATED_OS=1
409+
elif uname | grep -iq FreeBSD ; then
410+
DEPRECATED_OS=1
411+
elif uname | grep -iq Darwin ; then
412+
DEPRECATED_OS=1
413+
elif [ -f /etc/issue ] && grep -iq "Amazon Linux" /etc/issue ; then
414+
Bootstrap() {
415+
ExperimentalBootstrap "Amazon Linux" BootstrapRpmCommon
416+
}
417+
BOOTSTRAP_VERSION="BootstrapRpmCommon $BOOTSTRAP_RPM_COMMON_VERSION"
418+
elif [ -f /etc/product ] && grep -q "Joyent Instance" /etc/product ; then
419+
DEPRECATED_OS=1
420+
else
421+
DEPRECATED_OS=1
422+
fi
321423

322424
# We handle this case after determining the normal bootstrap version to allow
323425
# variables like USE_PYTHON_3 to be properly set. As described above, if the

tests/letstest/auto_targets.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,6 @@ targets:
5656
type: centos
5757
virt: hvm
5858
user: centos
59-
# centos6 requires EPEL repo added
60-
- ami: ami-1585c46a
61-
name: centos6
62-
type: centos
63-
virt: hvm
64-
user: centos
65-
userdata: |
66-
#cloud-config
67-
runcmd:
68-
- yum install -y epel-release
69-
- iptables -F
7059
- ami: ami-01ca03df4a6012157
7160
name: centos8
7261
type: centos

tests/letstest/scripts/test_leauto_upgrades.sh

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,15 @@ if ./letsencrypt-auto -v --debug --version | grep "WARNING: couldn't find Python
105105
exit 1
106106
fi
107107

108-
# Since certbot-auto is deprecated, we expect it to leave existing Certbot
109-
# installations unmodified so we check for the same version that was initially
110-
# installed below.
111-
EXPECTED_VERSION="$INITIAL_VERSION"
108+
# On systems like Debian where certbot-auto is deprecated, we expect it to
109+
# leave existing Certbot installations unmodified so we check for the same
110+
# version that was initially installed below. Once certbot-auto is deprecated
111+
# on RHEL systems, we can unconditionally check for INITIAL_VERSION.
112+
if [ -f /etc/debian_version ]; then
113+
EXPECTED_VERSION="$INITIAL_VERSION"
114+
else
115+
EXPECTED_VERSION=$(grep -m1 LE_AUTO_VERSION certbot-auto | cut -d\" -f2)
116+
fi
112117

113118
if ! /opt/eff.org/certbot/venv/bin/letsencrypt --version 2>&1 | tail -n1 | grep "^certbot $EXPECTED_VERSION$" ; then
114119
echo unexpected certbot version found
@@ -119,3 +124,22 @@ if ! diff letsencrypt-auto letsencrypt-auto-source/letsencrypt-auto ; then
119124
echo letsencrypt-auto and letsencrypt-auto-source/letsencrypt-auto differ
120125
exit 1
121126
fi
127+
128+
if [ "$RUN_RHEL6_TESTS" = 1 ]; then
129+
# Add the SCL python release to PATH in order to resolve python3 command
130+
PATH="/opt/rh/rh-python36/root/usr/bin:$PATH"
131+
if ! command -v python3; then
132+
echo "Python3 wasn't properly installed"
133+
exit 1
134+
fi
135+
if [ "$(/opt/eff.org/certbot/venv/bin/python -V 2>&1 | cut -d" " -f 2 | cut -d. -f1)" != 3 ]; then
136+
echo "Python3 wasn't used in venv!"
137+
exit 1
138+
fi
139+
140+
if [ "$("$PYTHON_NAME" tools/readlink.py $OLD_VENV_PATH)" != "/opt/eff.org/certbot/venv" ]; then
141+
echo symlink from old venv path not properly created!
142+
exit 1
143+
fi
144+
fi
145+
echo upgrade appeared to be successful

tests/letstest/scripts/test_letsencrypt_auto_certonly_standalone.sh

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,58 @@ sudo chown root "$LE_AUTO_PATH"
1616
sudo chmod 0755 "$LE_AUTO_PATH"
1717
export PATH="$LE_AUTO_DIR:$PATH"
1818

19-
# Since certbot-auto is deprecated, we expect certbot-auto to error and
20-
# refuse to install Certbot.
21-
set +o pipefail
22-
if ! letsencrypt-auto --debug --version | grep "Certbot cannot be installed."; then
23-
echo "letsencrypt-auto didn't report being uninstallable."
19+
# On systems like Debian where certbot-auto is deprecated, we expect
20+
# certbot-auto to error and refuse to install Certbot. Once certbot-auto is
21+
# deprecated on RHEL systems, we can unconditionally run this code.
22+
if [ -f /etc/debian_version ]; then
23+
set +o pipefail
24+
if ! letsencrypt-auto --debug --version | grep "Certbot cannot be installed."; then
25+
echo "letsencrypt-auto didn't report being uninstallable."
26+
exit 1
27+
fi
28+
if [ ${PIPESTATUS[0]} != 1 ]; then
29+
echo "letsencrypt-auto didn't exit with status 1 as expected"
30+
exit 1
31+
fi
32+
# letsencrypt-auto is deprecated and cannot be installed on this system so
33+
# we cannot run the rest of this test.
34+
exit 0
35+
fi
36+
37+
letsencrypt-auto --os-packages-only --debug --version
38+
39+
# This script sets the environment variables PYTHON_NAME, VENV_PATH, and
40+
# VENV_SCRIPT based on the version of Python available on the system. For
41+
# instance, Fedora uses Python 3 and Python 2 is not installed.
42+
. tests/letstest/scripts/set_python_envvars.sh
43+
44+
# Create a venv-like layout at the old virtual environment path to test that a
45+
# symlink is properly created when letsencrypt-auto runs.
46+
HOME=${HOME:-~root}
47+
XDG_DATA_HOME=${XDG_DATA_HOME:-~/.local/share}
48+
OLD_VENV_BIN="$XDG_DATA_HOME/letsencrypt/bin"
49+
mkdir -p "$OLD_VENV_BIN"
50+
touch "$OLD_VENV_BIN/letsencrypt"
51+
52+
letsencrypt-auto certonly --no-self-upgrade -v --standalone --debug \
53+
--text --agree-tos \
54+
--renew-by-default --redirect \
55+
--register-unsafely-without-email \
56+
--domain $PUBLIC_HOSTNAME --server $BOULDER_URL
57+
58+
LINK_PATH=$("$PYTHON_NAME" tools/readlink.py ${XDG_DATA_HOME:-~/.local/share}/letsencrypt)
59+
if [ "$LINK_PATH" != "/opt/eff.org/certbot/venv" ]; then
60+
echo symlink from old venv path not properly created!
2461
exit 1
2562
fi
26-
if [ ${PIPESTATUS[0]} != 1 ]; then
27-
echo "letsencrypt-auto didn't exit with status 1 as expected"
63+
64+
if ! letsencrypt-auto --help --no-self-upgrade | grep -F "letsencrypt-auto [SUBCOMMAND]"; then
65+
echo "letsencrypt-auto not included in help output!"
66+
exit 1
67+
fi
68+
69+
OUTPUT_LEN=$(letsencrypt-auto --install-only --no-self-upgrade --quiet 2>&1 | wc -c)
70+
if [ "$OUTPUT_LEN" != 0 ]; then
71+
echo letsencrypt-auto produced unexpected output!
2872
exit 1
2973
fi

tests/letstest/targets.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,6 @@ targets:
5252
type: centos
5353
virt: hvm
5454
user: centos
55-
# centos6 requires EPEL repo added
56-
- ami: ami-1585c46a
57-
name: centos6
58-
type: centos
59-
virt: hvm
60-
user: centos
61-
userdata: |
62-
#cloud-config
63-
runcmd:
64-
- yum install -y epel-release
65-
- iptables -F
6655
- ami: ami-01ca03df4a6012157
6756
name: centos8
6857
type: centos

0 commit comments

Comments
 (0)