From a313528ec843bdb8d470022efaaf3622571198f7 Mon Sep 17 00:00:00 2001 From: rallytime Date: Wed, 5 Jul 2017 15:32:08 -0600 Subject: [PATCH 1/2] Add Debian 9 support using official repo.saltstack.com packages Previously, the bootstrap script was using the packages for Debian 8 at repo.saltstack.com to install salt on Debian 9. Now that packages are available for Debian 9 for salt, this updates the bootstrap script to use Debian 9 packages instead of Debian 8. --- bootstrap-salt.sh | 82 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 71 insertions(+), 11 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 3a9569f..6e4d442 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1459,6 +1459,9 @@ __debian_codename_translation() { "8") DISTRO_CODENAME="jessie" ;; + "9") + DISTRO_CODENAME="stretch" + ;; *) DISTRO_CODENAME="jessie" ;; @@ -2924,17 +2927,8 @@ install_ubuntu_check_services() { # Debian Install Functions # __install_saltstack_debian_repository() { - if [ "$DISTRO_MAJOR_VERSION" -eq 9 ]; then - # Packages for Debian 9 at repo.saltstack.com are not yet available - # Set up repository for Debian 8 for Debian 9 for now until support - # is available at repo.saltstack.com for Debian 9. - DEBIAN_RELEASE="8" - else - DEBIAN_RELEASE="$DISTRO_MAJOR_VERSION" - fi - # amd64 is just a part of repository URI, 32-bit pkgs are hosted under the same location - SALTSTACK_DEBIAN_URL="${HTTP_VAL}://${_REPO_URL}/apt/debian/${DEBIAN_RELEASE}/${__REPO_ARCH}/${STABLE_REV}" + SALTSTACK_DEBIAN_URL="${HTTP_VAL}://${_REPO_URL}/apt/debian/${DISTRO_MAJOR_VERSION}/${__REPO_ARCH}/${STABLE_REV}" echo "deb $SALTSTACK_DEBIAN_URL $DISTRO_CODENAME main" > "/etc/apt/sources.list.d/saltstack.list" if [ "$HTTP_VAL" = "https" ] ; then @@ -2975,6 +2969,11 @@ install_debian_deps() { # YAML module is used for generating custom master/minion configs __PACKAGES="${__PACKAGES} python-yaml" + # Debian 9 needs the dirmgr package in order to import the GPG key later + if [ "$DISTRO_MAJOR_VERSION" -ge 9 ]; then + __PACKAGES="${__PACKAGES} dirmngr" + fi + # shellcheck disable=SC2086 __apt_get_install_noinput ${__PACKAGES} || return 1 @@ -3093,6 +3092,57 @@ install_debian_8_git_deps() { return 0 } +install_debian_9_git_deps() { + install_debian_deps || return 1 + + if ! __check_command_exists git; then + __apt_get_install_noinput git || return 1 + fi + + if [ "$_INSECURE_DL" -eq $BS_FALSE ] && [ "${_SALT_REPO_URL%%://*}" = "https" ]; then + __apt_get_install_noinput ca-certificates + fi + + __git_clone_and_checkout || return 1 + + __PACKAGES="libzmq5 lsb-release python-apt python-crypto python-jinja2 python-msgpack" + __PACKAGES="${__PACKAGES} python-requests python-systemd python-yaml python-zmq" + + if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then + # Install python-libcloud if asked to + __PACKAGES="${__PACKAGES} python-libcloud" + fi + + __PIP_PACKAGES='' + if (__check_pip_allowed >/dev/null 2>&1); then + __PIP_PACKAGES='tornado' + # Install development environment for building tornado Python module + __PACKAGES="${__PACKAGES} build-essential python-dev" + + if ! __check_command_exists pip; then + __PACKAGES="${__PACKAGES} python-pip" + fi + else + __PACKAGES="${__PACKAGES} python-backports-abc python-tornado" + fi + + # shellcheck disable=SC2086 + __apt_get_install_noinput ${__PACKAGES} || return 1 + + if [ "${__PIP_PACKAGES}" != "" ]; then + # shellcheck disable=SC2086,SC2090 + pip install -U ${__PIP_PACKAGES} || return 1 + fi + + # Let's trigger config_salt() + if [ "$_TEMP_CONFIG_DIR" = "null" ]; then + _TEMP_CONFIG_DIR="${_SALT_GIT_CHECKOUT_DIR}/conf/" + CONFIG_SALT_FUNC="config_salt" + fi + + return 0 +} + install_debian_stable() { __PACKAGES="" @@ -3125,9 +3175,14 @@ install_debian_8_stable() { return 0 } +install_debian_9_stable() { + install_debian_stable || return 1 + return 0 +} + install_debian_git() { if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install --install-layout=deb || return 1 + python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install --install-layout=deb || return 1 else python setup.py ${SETUP_PY_INSTALL_ARGS} install --install-layout=deb || return 1 fi @@ -3143,6 +3198,11 @@ install_debian_8_git() { return 0 } +install_debian_9_git() { + install_debian_git || return 1 + return 0 +} + install_debian_git_post() { for fname in api master minion syndic; do # Skip if not meant to be installed From 65866f3d441dc2d451b38ffd372728d9046353c4 Mon Sep 17 00:00:00 2001 From: rallytime Date: Thu, 6 Jul 2017 12:11:02 -0600 Subject: [PATCH 2/2] Remove pip installation code for tornado Debian 9 provides a new enough version of tornado, so we don't need to use the pip install work-around. --- bootstrap-salt.sh | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 6e4d442..26f2c8e 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3105,35 +3105,18 @@ install_debian_9_git_deps() { __git_clone_and_checkout || return 1 - __PACKAGES="libzmq5 lsb-release python-apt python-crypto python-jinja2 python-msgpack" - __PACKAGES="${__PACKAGES} python-requests python-systemd python-yaml python-zmq" + __PACKAGES="libzmq5 lsb-release python-apt python-backports-abc python-crypto" + __PACKAGES="${__PACKAGES} python-jinja2 python-msgpack python-requests python-systemd" + __PACKAGES="${__PACKAGES} python-tornado python-yaml python-zmq" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then # Install python-libcloud if asked to __PACKAGES="${__PACKAGES} python-libcloud" fi - __PIP_PACKAGES='' - if (__check_pip_allowed >/dev/null 2>&1); then - __PIP_PACKAGES='tornado' - # Install development environment for building tornado Python module - __PACKAGES="${__PACKAGES} build-essential python-dev" - - if ! __check_command_exists pip; then - __PACKAGES="${__PACKAGES} python-pip" - fi - else - __PACKAGES="${__PACKAGES} python-backports-abc python-tornado" - fi - # shellcheck disable=SC2086 __apt_get_install_noinput ${__PACKAGES} || return 1 - if [ "${__PIP_PACKAGES}" != "" ]; then - # shellcheck disable=SC2086,SC2090 - pip install -U ${__PIP_PACKAGES} || return 1 - fi - # Let's trigger config_salt() if [ "$_TEMP_CONFIG_DIR" = "null" ]; then _TEMP_CONFIG_DIR="${_SALT_GIT_CHECKOUT_DIR}/conf/"