mirror of
https://github.com/certbot/certbot.git
synced 2026-06-05 14:54:24 -04:00
Working centos6 letsencrypt-auto self tests
This commit is contained in:
parent
7b456cdf75
commit
66d1d406ee
2 changed files with 43 additions and 22 deletions
|
|
@ -27,11 +27,17 @@ RUN mkdir -p /home/lea/certbot
|
|||
COPY ./tests/certs/ca/my-root-ca.crt.pem /usr/local/share/ca-certificates/
|
||||
RUN update-ca-trust
|
||||
|
||||
# Copy code:
|
||||
# Copy current letsencrypt-auto:
|
||||
COPY . /home/lea/certbot/letsencrypt-auto-source
|
||||
|
||||
# Fetch previous letsencrypt-auto that was installing python 3.4
|
||||
RUN curl https://raw.githubusercontent.com/certbot/certbot/v0.36.0/letsencrypt-auto-source/letsencrypt-auto \
|
||||
-o /home/lea/certbot/letsencrypt-auto-source/letsencrypt-auto_pre_0_37 \
|
||||
&& chmod +x /home/lea/certbot/letsencrypt-auto-source/letsencrypt-auto_pre_0_37
|
||||
|
||||
RUN chmod +x /home/lea/certbot/letsencrypt-auto-source/tests/centos6_tests.sh
|
||||
|
||||
USER lea
|
||||
WORKDIR /home/lea
|
||||
|
||||
RUN sudo chmod +x certbot/letsencrypt-auto-source/tests/centos6_tests.sh
|
||||
CMD sudo certbot/letsencrypt-auto-source/tests/centos6_tests.sh
|
||||
CMD ["sudo", "certbot/letsencrypt-auto-source/tests/centos6_tests.sh"]
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ yum update -y > /dev/null
|
|||
yum install -y centos-release-scl > /dev/null
|
||||
yum install -y python27 > /dev/null 2> /dev/null
|
||||
|
||||
LE_AUTO_PRE_0_37="certbot/letsencrypt-auto-source/letsencrypt-auto_pre_0_37"
|
||||
LE_AUTO="certbot/letsencrypt-auto-source/letsencrypt-auto"
|
||||
|
||||
# we're going to modify env variables, so do this in a subshell
|
||||
|
|
@ -11,18 +12,18 @@ LE_AUTO="certbot/letsencrypt-auto-source/letsencrypt-auto"
|
|||
source /opt/rh/python27/enable
|
||||
|
||||
# ensure python 3 isn't installed
|
||||
python3 --version 2> /dev/null
|
||||
python3 --version > /dev/null 2> /dev/null
|
||||
RESULT=$?
|
||||
if [ $RESULT -eq 0 ]; then
|
||||
error "Python3 is already installed."
|
||||
echo "ERROR: Python3 is already installed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ensure python2.7 is available
|
||||
python2.7 --version 2> /dev/null
|
||||
python2.7 --version > /dev/null 2> /dev/null
|
||||
RESULT=$?
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
error "Python3 is not available."
|
||||
echo "ERROR: Python2.7 is not available."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -30,49 +31,63 @@ fi
|
|||
"$LE_AUTO" --no-self-upgrade -n > /dev/null 2> /dev/null
|
||||
|
||||
# ensure python 3 isn't installed
|
||||
python3 --version 2> /dev/null
|
||||
python3 --version > /dev/null 2> /dev/null
|
||||
RESULT=$?
|
||||
if [ $RESULT -eq 0 ]; then
|
||||
error "letsencrypt-auto installed Python3 even though Python2.7 is present."
|
||||
echo "ERROR: letsencrypt-auto installed Python3 even though Python2.7 is present."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "PASSED: Did not upgrade to Python3 when Python2.7 is present."
|
||||
)
|
||||
|
||||
# ensure python2.7 isn't available
|
||||
python2.7 --version 2> /dev/null
|
||||
python2.7 --version > /dev/null 2> /dev/null
|
||||
RESULT=$?
|
||||
if [ $RESULT -eq 0 ]; then
|
||||
error "Python2.7 is still available."
|
||||
error "ERROR: Python2.7 is still available."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Skip self upgrade due to Python 3 not being available.
|
||||
if ! "$LE_AUTO" 2>&1 | grep -q "WARNING: couldn't find Python"; then
|
||||
echo "Python upgrade failure warning not printed!"
|
||||
echo "ERROR: Python upgrade failure warning not printed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# bootstrap, this time installing python3
|
||||
"$LE_AUTO" --no-self-upgrade -n > /dev/null 2> /dev/null
|
||||
# add SCL rh-python36 to path for proper python 3.x resolution
|
||||
PATH="/opt/rh/rh-python36/root/usr/bin:$PATH"
|
||||
|
||||
# ensure python 3 is installed
|
||||
python3 --version > /dev/null
|
||||
# bootstrap from the old letsencrypt-auto, this time installing python3.4
|
||||
"$LE_AUTO_PRE_0_37" --no-self-upgrade -n > /dev/null 2> /dev/null
|
||||
|
||||
# ensure python 3.4 is installed
|
||||
python3.4 --version > /dev/null 2> /dev/null
|
||||
RESULT=$?
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
error "letsencrypt-auto failed to install Python3 when only Python2.6 is present."
|
||||
echo "ERROR: letsencrypt-auto failed to install Python3.4 using letsencrypt-auto < 0.37.0 when only Python2.6 is present."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "PASSED: Successfully upgraded to Python3 when only Python2.6 is present."
|
||||
echo ""
|
||||
echo "PASSED: Successfully upgraded to Python3.4 using letsencrypt-auto < 0.37.0 when only Python2.6 is present."
|
||||
|
||||
# now bootstrap from current letsencrypt-auto, that will install python3.6 from SCL
|
||||
"$LE_AUTO" --no-self-upgrade -n > /dev/null 2> /dev/null
|
||||
|
||||
# ensure python 3.6 is installed
|
||||
python3.6 --version > /dev/null 2> /dev/null
|
||||
RESULT=$?
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
echo "ERROR: letsencrypt-auto failed to install Python3.6 using current letsencrypt-auto when only Python2.6/Python3.4 are present."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "PASSED: Successfully upgraded to Python3.6 using curent letsencrypt-auto when only Python2.6/Python3.4 are present."
|
||||
|
||||
export VENV_PATH=$(mktemp -d)
|
||||
"$LE_AUTO" -n --no-bootstrap --no-self-upgrade --version >/dev/null 2>&1
|
||||
if [ "$($VENV_PATH/bin/python -V 2>&1 | cut -d" " -f2 | cut -d. -f1)" != 3 ]; then
|
||||
echo "Python 3 wasn't used with --no-bootstrap!"
|
||||
if [ "$($VENV_PATH/bin/python -V 2>&1 | cut -d" " -f2 | cut -d. -f1-2)" != "3.6" ]; then
|
||||
echo "ERROR: Python 3.6 wasn't used with --no-bootstrap!"
|
||||
exit 1
|
||||
fi
|
||||
unset VENV_PATH
|
||||
|
|
|
|||
Loading…
Reference in a new issue