From f184a1d3ac4479f4857a4a3dfddc186d0567b6ee Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Wed, 15 Aug 2018 16:38:00 +0200 Subject: [PATCH 1/2] dnfBgone rebase --- bootstrap-salt.sh | 56 +++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 687c1b3..2de6ac5 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3415,36 +3415,32 @@ install_debian_check_services() { # install_fedora_deps() { + if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then + dnf -y update || return 1 + fi + if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then # Packages are named python3- PY_PKG_VER=3 - __PACKAGES="python3-m2crypto python3-PyYAML" + __PACKAGES="${__PACKAGES} python3-m2crypto python3-PyYAML" else PY_PKG_VER=2 - __PACKAGES="m2crypto" + __PACKAGES="${__PACKAGES} m2crypto" if [ "$DISTRO_MAJOR_VERSION" -ge 28 ]; then __PACKAGES="${__PACKAGES} python2-pyyaml" else __PACKAGES="${__PACKAGES} PyYAML" fi fi - - __PACKAGES="${__PACKAGES} procps-ng dnf-utils libyaml python${PY_PKG_VER}-crypto python${PY_PKG_VER}-jinja2" + __PACKAGES="${__PACKAGES} dnf-utils libyaml procps-ng python${PY_PKG_VER}-crypto python${PY_PKG_VER}-jinja2" __PACKAGES="${__PACKAGES} python${PY_PKG_VER}-msgpack python${PY_PKG_VER}-requests python${PY_PKG_VER}-zmq" - - # shellcheck disable=SC2086 - dnf install -y ${__PACKAGES} || return 1 - - if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then - dnf -y update || return 1 - fi - if [ "${_EXTRA_PACKAGES}" != "" ]; then echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" - # shellcheck disable=SC2086 - dnf install -y ${_EXTRA_PACKAGES} || return 1 fi + # shellcheck disable=SC2086 + dnf install -y ${__PACKAGES} ${_EXTRA_PACKAGES} || return 1 + return 0 } @@ -3494,36 +3490,38 @@ install_fedora_git_deps() { PY_PKG_VER=2 fi + __PACKAGES= if [ "$_INSECURE_DL" -eq $BS_FALSE ] && [ "${_SALT_REPO_URL%%://*}" = "https" ]; then - dnf install -y ca-certificates || return 1 + __PACKAGES="${__PACKAGES} ca-certificates" + fi + if ! __check_command_exists git; then + __PACKAGES="${__PACKAGES} git" + fi + if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then + __PACKAGES="${__PACKAGES} python${PY_PKG_VER}-libcloud python${PY_PKG_VER}-netaddr" + fi + __PACKAGES="${__PACKAGES} python${PY_PKG_VER}-systemd" + + # Fedora 28+ ships with tornado 5.0+ which is broken for salt on py3 + # https://github.com/saltstack/salt-bootstrap/issues/1220 + if [ "${PY_PKG_VER}" -lt 3 ] || [ "$DISTRO_MAJOR_VERSION" -lt 28 ]; then + __PACKAGES="${__PACKAGES} python${PY_PKG_VER}-tornado" fi install_fedora_deps || return 1 - if ! __check_command_exists git; then - dnf install -y git || return 1 - fi - __git_clone_and_checkout || return 1 - __PACKAGES="python${PY_PKG_VER}-systemd" + # Fedora 28+ needs tornado <5.0 from pip + # https://github.com/saltstack/salt-bootstrap/issues/1220 if [ "${PY_PKG_VER}" -eq 3 ] && [ "$DISTRO_MAJOR_VERSION" -ge 28 ]; then __check_pip_allowed "You need to allow pip based installations (-P) for Tornado <5.0 in order to install Salt on Python 3" grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" | while IFS=' ' read -r dep; do "${_PY_EXE}" -m pip install "${dep}" || return 1 done - else - __PACKAGES="${__PACKAGES} python${PY_PKG_VER}-tornado" fi - if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then - __PACKAGES="${__PACKAGES} python${PY_PKG_VER}-libcloud python${PY_PKG_VER}-netaddr" - fi - - # shellcheck disable=SC2086 - dnf install -y ${__PACKAGES} || return 1 - # Let's trigger config_salt() if [ "$_TEMP_CONFIG_DIR" = "null" ]; then _TEMP_CONFIG_DIR="${_SALT_GIT_CHECKOUT_DIR}/conf/" From c432e49788ffa2eca22579f3f9223af36f5c0480 Mon Sep 17 00:00:00 2001 From: Ronald van Zantvoort Date: Tue, 14 Aug 2018 19:21:14 +0200 Subject: [PATCH 2/2] Fedora: prevent possible unassigned operator error in stable install as well --- bootstrap-salt.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 2de6ac5..d8ec859 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3419,6 +3419,7 @@ install_fedora_deps() { dnf -y update || return 1 fi + __PACKAGES="${__PACKAGES:=}" if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then # Packages are named python3- PY_PKG_VER=3 @@ -3490,7 +3491,7 @@ install_fedora_git_deps() { PY_PKG_VER=2 fi - __PACKAGES= + __PACKAGES="${__PACKAGES:=}" if [ "$_INSECURE_DL" -eq $BS_FALSE ] && [ "${_SALT_REPO_URL%%://*}" = "https" ]; then __PACKAGES="${__PACKAGES} ca-certificates" fi