Skip to content

Commit

Permalink
Fix --no-bootstrap on CentOS/RHEL 6 (#5476)
Browse files Browse the repository at this point in the history
* fix --no-bootstrap on RHEL6

* Add regression test
  • Loading branch information
bmw authored and ohemorange committed Jan 25, 2018
1 parent 8a9f21c commit a1aba58
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 14 deletions.
20 changes: 13 additions & 7 deletions letsencrypt-auto-source/letsencrypt-auto
Expand Up @@ -761,13 +761,8 @@ BootstrapMageiaCommon() {
# Set Bootstrap to the function that installs OS dependencies on this system
# and BOOTSTRAP_VERSION to the unique identifier for the current version of
# that function. If Bootstrap is set to a function that doesn't install any
# packages (either because --no-bootstrap was included on the command line or
# we don't know how to bootstrap on this system), BOOTSTRAP_VERSION is not set.
if [ "$NO_BOOTSTRAP" = 1 ]; then
Bootstrap() {
:
}
elif [ -f /etc/debian_version ]; then
# packages BOOTSTRAP_VERSION is not set.
if [ -f /etc/debian_version ]; then
Bootstrap() {
BootstrapMessage "Debian-based OSes"
BootstrapDebCommon
Expand Down Expand Up @@ -863,6 +858,17 @@ else
}
fi

# We handle this case after determining the normal bootstrap version to allow
# variables like USE_PYTHON_3 to be properly set. As described above, if the
# Bootstrap function doesn't install any packages, BOOTSTRAP_VERSION should not
# be set so we unset it here.
if [ "$NO_BOOTSTRAP" = 1 ]; then
Bootstrap() {
:
}
unset BOOTSTRAP_VERSION
fi

# Sets PREV_BOOTSTRAP_VERSION to the identifier for the bootstrap script used
# to install OS dependencies on this system. PREV_BOOTSTRAP_VERSION isn't set
# if it is unknown how OS dependencies were installed on this system.
Expand Down
20 changes: 13 additions & 7 deletions letsencrypt-auto-source/letsencrypt-auto.template
Expand Up @@ -300,13 +300,8 @@ DeterminePythonVersion() {
# Set Bootstrap to the function that installs OS dependencies on this system
# and BOOTSTRAP_VERSION to the unique identifier for the current version of
# that function. If Bootstrap is set to a function that doesn't install any
# packages (either because --no-bootstrap was included on the command line or
# we don't know how to bootstrap on this system), BOOTSTRAP_VERSION is not set.
if [ "$NO_BOOTSTRAP" = 1 ]; then
Bootstrap() {
:
}
elif [ -f /etc/debian_version ]; then
# packages BOOTSTRAP_VERSION is not set.
if [ -f /etc/debian_version ]; then
Bootstrap() {
BootstrapMessage "Debian-based OSes"
BootstrapDebCommon
Expand Down Expand Up @@ -402,6 +397,17 @@ else
}
fi

# We handle this case after determining the normal bootstrap version to allow
# variables like USE_PYTHON_3 to be properly set. As described above, if the
# Bootstrap function doesn't install any packages, BOOTSTRAP_VERSION should not
# be set so we unset it here.
if [ "$NO_BOOTSTRAP" = 1 ]; then
Bootstrap() {
:
}
unset BOOTSTRAP_VERSION
fi

# Sets PREV_BOOTSTRAP_VERSION to the identifier for the bootstrap script used
# to install OS dependencies on this system. PREV_BOOTSTRAP_VERSION isn't set
# if it is unknown how OS dependencies were installed on this system.
Expand Down
8 changes: 8 additions & 0 deletions letsencrypt-auto-source/tests/centos6_tests.sh
Expand Up @@ -69,5 +69,13 @@ fi
echo "PASSED: Successfully upgraded to Python3 when only Python2.6 is present."
echo ""

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!"
exit 1
fi
unset VENV_PATH

# test using python3
pytest -v -s certbot/letsencrypt-auto-source/tests

0 comments on commit a1aba58

Please sign in to comment.