From cda950bd31b57e8b35298517f0316b80bb67c8a1 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Tue, 22 Nov 2016 12:10:02 +0200 Subject: [PATCH] Configure Salt components after the dependencies installation --- bootstrap-salt.sh | 53 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index da8f78c..7f1ddc9 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -475,7 +475,7 @@ fi # Check that we're installing or configuring a master if we're being passed a master config json dict if [ "$_CUSTOM_MASTER_CONFIG" != "null" ]; then if [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && [ "$_CONFIG_ONLY" -eq $BS_FALSE ]; then - echoerror "Don't pass a master config json dict (-J) if no master is going to be bootstrapped or configured." + echoerror "Don't pass a master config JSON dict (-J) if no master is going to be bootstrapped or configured." exit 1 fi fi @@ -483,7 +483,7 @@ fi # Check that we're installing or configuring a minion if we're being passed a minion config json dict if [ "$_CUSTOM_MINION_CONFIG" != "null" ]; then if [ "$_INSTALL_MINION" -eq $BS_FALSE ] && [ "$_CONFIG_ONLY" -eq $BS_FALSE ]; then - echoerror "Don't pass a minion config json dict (-j) if no minion is going to be bootstrapped or configured." + echoerror "Don't pass a minion config JSON dict (-j) if no minion is going to be bootstrapped or configured." exit 1 fi fi @@ -850,7 +850,7 @@ __derive_debian_numeric_version() { # DESCRIPTION: Strip single or double quotes from the provided string. #---------------------------------------------------------------------------------------------------------------------- __unquote_string() { - echo "$*" | sed -e "s/^\([\"']\)\(.*\)\1\$/\2/g" + echo "$*" | sed -e "s/^\([\"\']\)\(.*\)\1\$/\2/g" } #--- FUNCTION ------------------------------------------------------------------------------------------------------- @@ -2311,7 +2311,6 @@ install_ubuntu_deps() { __apt_get_install_noinput python-software-properties || return 1 fi - if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then __enable_universe_repository || return 1 @@ -2353,6 +2352,9 @@ install_ubuntu_deps() { # requests is still used by many salt modules __PACKAGES="${__PACKAGES} python-requests" + # YAML module is used for generating custom master/minion configs + __PACKAGES="${__PACKAGES} python-yaml" + # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 __PACKAGES="${__PACKAGES} procps pciutils" @@ -2759,6 +2761,9 @@ install_debian_deps() { __PACKAGES="procps pciutils" __PIP_PACKAGES="" + # YAML module is used for generating custom master/minion configs + __PACKAGES="${__PACKAGES} python-yaml" + # shellcheck disable=SC2086 __apt_get_install_noinput ${__PACKAGES} || return 1 @@ -2845,6 +2850,9 @@ install_debian_7_deps() { # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 __PACKAGES='procps pciutils' + # YAML module is used for generating custom master/minion configs + __PACKAGES="${__PACKAGES} python-yaml" + # shellcheck disable=SC2086 __apt_get_install_noinput ${__PACKAGES} || return 1 @@ -2924,9 +2932,8 @@ install_debian_8_deps() { # shellcheck disable=SC2086 __apt_get_install_noinput ${__PACKAGES} || return 1 - if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then - __apt_get_upgrade_noinput || return 1 - fi + # YAML module is used for generating custom master/minion configs + __PACKAGES="${__PACKAGES} python-yaml" if [ "${_EXTRA_PACKAGES}" != "" ]; then echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" @@ -3532,14 +3539,23 @@ install_centos_stable_deps() { __PACKAGES="yum-utils chkconfig" - if [ "${_EXTRA_PACKAGES}" != "" ]; then - echoinfo "Also installing the following extra packages as requested: ${_EXTRA_PACKAGES}" - __PACKAGES="${__PACKAGES} ${_EXTRA_PACKAGES}" + # YAML module is used for generating custom master/minion configs + if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then + __PACKAGES="${__PACKAGES} python26-PyYAML" + else + __PACKAGES="${__PACKAGES} PyYAML" fi # shellcheck disable=SC2086 __yum_install_noinput ${__PACKAGES} || return 1 + if [ "${_EXTRA_PACKAGES}" != "" ]; then + echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" + # shellcheck disable=SC2086 + __yum_install_noinput ${_EXTRA_PACKAGES} || return 1 + fi + + return 0 } @@ -3608,10 +3624,10 @@ install_centos_git_deps() { __PACKAGES="" if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then - __PACKAGES="${__PACKAGES} python26-PyYAML python26 python26-requests" - __PACKAGES="${__PACKAGES} python26-crypto python26-jinja2 python26-msgpack python26-tornado python26-zmq" + __PACKAGES="${__PACKAGES} python26 python26-crypto python26-jinja2 python26-msgpack python26-requests" + __PACKAGES="${__PACKAGES} python26-tornado python26-zmq" else - __PACKAGES="${__PACKAGES} PyYAML python-crypto python-futures python-msgpack python-zmq python-jinja2" + __PACKAGES="${__PACKAGES} python-crypto python-futures python-msgpack python-zmq python-jinja2" __PACKAGES="${__PACKAGES} python-requests python-tornado" fi @@ -4242,6 +4258,9 @@ install_arch_linux_stable_deps() { pacman-db-upgrade || return 1 fi + # YAML module is used for generating custom master/minion configs + pacman -Sy --noconfirm --needed python2-yaml + if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then pacman -Syyu --noconfirm --needed || return 1 fi @@ -4266,7 +4285,7 @@ install_arch_linux_git_deps() { fi pacman -R --noconfirm python2-distribute pacman -Sy --noconfirm --needed python2-crypto python2-setuptools python2-jinja \ - python2-markupsafe python2-msgpack python2-psutil python2-yaml \ + python2-markupsafe python2-msgpack python2-psutil \ python2-pyzmq zeromq python2-requests python2-systemd || return 1 __git_clone_and_checkout || return 1 @@ -4519,6 +4538,10 @@ install_freebsd_9_stable_deps() { # shellcheck disable=SC2086 /usr/local/sbin/pkg install ${FROM_FREEBSD} -y swig || return 1 + # YAML module is used for generating custom master/minion configs + # shellcheck disable=SC2086 + /usr/local/sbin/pkg install ${FROM_FREEBSD} -y py27-yaml || return 1 + if [ "${_EXTRA_PACKAGES}" != "" ]; then echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" # shellcheck disable=SC2086 @@ -6120,7 +6143,7 @@ for FUNC_NAME in $(__strip_duplicates "$DEP_FUNC_NAMES"); do done echodebug "DEPS_INSTALL_FUNC=${DEPS_INSTALL_FUNC}" -# Let's get the minion config function +# Let's get the Salt config function CONFIG_FUNC_NAMES="config_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_${ITYPE}_salt" CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_${ITYPE}_salt" CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_salt"