diff --git a/.gitignore b/.gitignore index a4b29eb..2120008 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ /.project -*.swp +*.sw? .vagrant # Pycharm .idea - diff --git a/AUTHORS.rst b/AUTHORS.rst index 1df5846..b96b08f 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -20,6 +20,7 @@ Brad Thurber bradthurber Brandon Clifford brandon099 brandon.clifford@vivint.com Bret Fisher BretFisher bret@fishbrains.com bruce-one bruce-one +Вячеслав Спиридонов sp1r C. R. Oldham cro cr@saltstack.com Cam camereonsparr Chris Rebert cvrebert chris.rebert@hulu.com @@ -37,9 +38,11 @@ Diego Woitasen diegows diego@flugel.it Elias Probst eliasp eliezerlp eliezerlp Emiel Kollof ekollof +Eric Radman eradman ericshane@eradman.com Erik Ankrom erikankrom Erik Johnson terminalmage erik@saltstack.com EYJ eyj +fizmat fizmat Forrest Alvarez gravyboat Fred Reimer freimer freimer@freimer.org Geoff Garside geoffgarside geoff@geoffgarside.co.uk @@ -55,12 +58,13 @@ Jared E Stroud jaredestroud jaredestroud@gmail.com Jeff Hui jeffh jeff@jeffhui.net Jeff Strunk jstrunk Juan A. Moyano wincus wincus.public@gmail.com -Justin Anderson jtand janderson@saltstack.com +Justin Anderson justinta justin.ta@outlook.com Justin Findlay jfindlay jfindlay@gmail.com Karl Grzeszczak karlgrz Kenneth Wilke KennethWilke lomeroe lomeroe Liu Xiaohui oreh herolxh@gmail.com +Lubomir Host lhost Marc Vieira-Cardinal marccadinal Mark Lee malept Marcus Furlong furlongm furlongm@gmail.com @@ -86,6 +90,7 @@ Paul Brian lifeisstillgood paul@mikadosoftware.com Pavel Snagovsky paha Pedro Algarvio s0undt3ch pedro@algarvio.me Pedro Paulo pedropaulovc +Pete Lumbis plumbis Peter Tripp notpeter Petr Michalec epcim Prayag Verma pra85 prayag.verma@gmail.com diff --git a/ChangeLog b/ChangeLog index 62f6b9c..785189d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,24 @@ -Version 2106.08.16: +Version 2016.10.25: + * Update AUTHORS.rst with new contributors (rallytime) #978 + * Let's start detecting the upcoming Debian 9 (Stretch) (lhost) #975 + * FreeBSD: set _SALT_ETC_DIR directory to match ports (eradman) #970 + * Update OpenBSD 6.0+ provisioning (eradman) #969 + * adds supports for Cumulus Linux (plumbis) #967 + * Run "pip install -U futures" for SmartOS git install (rallytime) #966 + * Change /pkg/rpm/ to /pkg/deb/ in install_ubuntu_git_post func (rallytime) #965 + * SUSE: Refactor systemsmanagement_saltstack repo checks to be DRY (rallytime) #964 + * Fix detection of EPEL repository with not-expired metadata (sp1r) #963 + * Display warning message about deprecating the `-G` option (vutny) #958 + * Allow correct salt paths to be used when -c is passed (justinta) #955 + * Fix issues with replacing configs when python3 is default in os. (fizmat) #954 + * Remove m2crypto package installs (rallytime) #951 + * Try to install SP4 packages on SLE 11 when SP version is older (rallytime) #950 + * Add python-futures package to install_centos_git_deps (rallytime) #948 + * Add /etc/portage/package.accept_keywords to CONFIG_PROTECT_MASK (rallytime) #947 + * Deprecate `-G` option: use `https` scheme for GitHub by default (vutny) #945 + * [SECURITY] Properly handle GnuPG keys for APT repositories (vutny) #940 + +Version 2016.08.16: * Ubuntu git mode: install all deps from SaltStack corp repo by default. (vutny) #936 Version 2016.08.15: diff --git a/README.rst b/README.rst index 33e7763..951f9e0 100644 --- a/README.rst +++ b/README.rst @@ -66,7 +66,7 @@ If you want to install a specific release version (based on the Git tags): .. code:: console curl -o bootstrap_salt.sh -L https://bootstrap.saltstack.com - sudo sh bootstrap_salt.sh git v2015.8.8 + sudo sh bootstrap_salt.sh git v2016.3.2 To install a specific branch from a Git fork: @@ -88,7 +88,7 @@ If your host has Internet access only via HTTP proxy: PROXY='http://user:password@myproxy.example.com:3128' curl -o bootstrap_salt.sh -L -x "$PROXY" https://bootstrap.saltstack.com - sudo sh bootstrap_salt.sh -G -H "$PROXY" git + sudo sh bootstrap_salt.sh -H "$PROXY" git Install using wget @@ -106,7 +106,7 @@ Installing a specific version from git using ``wget``: .. code:: console wget -O bootstrap_salt.sh https://bootstrap.saltstack.com - sudo sh bootstrap_salt.sh -P git v2015.8.7 + sudo sh bootstrap_salt.sh -P git v2015.8.11 .. note:: @@ -548,8 +548,8 @@ Salt is ready and working in the Docker container with Minion authenticated on M .. _`pre-accepted Minion key`: https://docs.saltstack.com/en/latest/topics/tutorials/preseed_key.html -.. vim: fenc=utf-8 spell spl=en cc=100 tw=99 fo=want sts=2 sw=2 et - .. |windows_build| image:: https://ci.appveyor.com/api/projects/status/github/saltstack/salt-bootstrap?branch=develop&svg=true :target: https://ci.appveyor.com/project/saltstack-public/salt-bootstrap :alt: Build status of the develop branch on Windows + +.. vim: fenc=utf-8 spell spl=en cc=100 tw=99 fo=want sts=2 sw=2 et diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 681929c..1028a33 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -18,7 +18,7 @@ #====================================================================================================================== set -o nounset # Treat unset variables as an error -__ScriptVersion="2016.08.16" +__ScriptVersion="2016.10.25" __ScriptName="bootstrap-salt.sh" __ScriptFullName="$0" @@ -193,7 +193,7 @@ __check_config_dir() { #---------------------------------------------------------------------------------------------------------------------- _KEEP_TEMP_FILES=${BS_KEEP_TEMP_FILES:-$BS_FALSE} _TEMP_CONFIG_DIR="null" -_SALTSTACK_REPO_URL="git://github.com/saltstack/salt.git" +_SALTSTACK_REPO_URL="https://github.com/saltstack/salt.git" _SALT_REPO_URL=${_SALTSTACK_REPO_URL} _DOWNSTREAM_PKG_REPO=$BS_FALSE _TEMP_KEYS_DIR="null" @@ -218,9 +218,10 @@ _EPEL_REPO=${BS_EPEL_REPO:-epel} _EPEL_REPOS_INSTALLED=$BS_FALSE _UPGRADE_SYS=${BS_UPGRADE_SYS:-$BS_FALSE} _INSECURE_DL=${BS_INSECURE_DL:-$BS_FALSE} -_WGET_ARGS=${BS_WGET_ARGS:-} _CURL_ARGS=${BS_CURL_ARGS:-} _FETCH_ARGS=${BS_FETCH_ARGS:-} +_GPG_ARGS=${BS_GPG_ARGS:-} +_WGET_ARGS=${BS_WGET_ARGS:-} _ENABLE_EXTERNAL_ZMQ_REPOS=${BS_ENABLE_EXTERNAL_ZMQ_REPOS:-$BS_FALSE} _SALT_MASTER_ADDRESS=${BS_SALT_MASTER_ADDRESS:-null} _SALT_MINION_ID="null" @@ -280,10 +281,6 @@ __usage() { -D Show debug output -c Temporary configuration directory -g Salt Git repository URL. Default: ${_SALTSTACK_REPO_URL} - -G Instead of cloning from ${_SALTSTACK_REPO_URL}, clone from - https://${_SALTSTACK_REPO_URL#*://} - (usually necessary on systems which have the regular git protocol port - blocked, where https usually is not) -w Install packages from downstream package repository rather than upstream, saltstack package repository. This is currently only implemented for SUSE. @@ -299,21 +296,22 @@ __usage() { -d Disables checking if Salt services are enabled to start on system boot. You can also do this by touching /tmp/disable_salt_checks on the target host. Default: \${BS_FALSE} - -C Only run the configuration function. This option automatically bypasses - any installation. Implies -F (forced overwrite). To overwrite master or - syndic configs, -M or -S, respectively, must also be specified. -P Allow pip based installations. On some distributions the required salt packages or its dependencies are not available as a package for that distribution. Using this flag allows the script to use pip as a last resort method. NOTE: This only works for functions which actually implement pip based installations. - -F Allow copied files to overwrite existing (config, init.d, etc) -U If set, fully upgrade the system prior to bootstrapping Salt - -K If set, keep the temporary files in the temporary directories specified - with -c and -k -I If set, allow insecure connections while downloading any files. For example, pass '--no-check-certificate' to 'wget' or '--insecure' to - 'curl' + 'curl'. On Debian and Ubuntu, using this option with -U allows to obtain + GnuPG archive keys insecurely if distro has changed release signatures. + -F Allow copied files to overwrite existing (config, init.d, etc) + -K If set, keep the temporary files in the temporary directories specified + with -c and -k + -C Only run the configuration function. This option automatically bypasses + any installation. Implies -F (forced overwrite). To overwrite master or + syndic configs, -M or -S, respectively, must also be specified. -A Pass the salt-master DNS name or IP. This will be stored under \${BS_SALT_ETC_DIR}/minion.d/99-master-address.conf -i Pass the salt-minion id. This will be stored under @@ -360,7 +358,7 @@ EOT } # ---------- end of function __usage ---------- -while getopts ":hvnDc:Gg:wk:s:MSNXCPFUKIA:i:Lp:dH:ZbflV:J:j:rR:aq" opt +while getopts ':hvnDc:g:Gwk:s:MSNXCPFUKIA:i:Lp:dH:ZbflV:J:j:rR:aq' opt do case "${opt}" in @@ -383,12 +381,9 @@ do g ) _SALT_REPO_URL=$OPTARG ;; - G ) if [ "${_SALT_REPO_URL}" = "${_SALTSTACK_REPO_URL}" ]; then - _SALTSTACK_REPO_URL="https://github.com/saltstack/salt.git" - _SALT_REPO_URL=${_SALTSTACK_REPO_URL} - else - _SALTSTACK_REPO_URL="https://github.com/saltstack/salt.git" - fi + G ) echowarn "The '-G' option is DEPRECATED and will be removed in the future stable release!" + echowarn "Bootstrap will always use 'https' protocol to clone from SaltStack GitHub repo." + echowarn "No need to provide this option anymore, now it is a default behavior." ;; w ) _DOWNSTREAM_PKG_REPO=$BS_TRUE ;; @@ -544,11 +539,11 @@ fi # -a and -V only work from git if [ "$ITYPE" != "git" ]; then if [ $_PIP_ALL -eq $BS_TRUE ]; then - echoerror "Pip installing all python packages with -a is only possible when installing salt via git" + echoerror "Pip installing all python packages with -a is only possible when installing Salt via git" exit 1 fi if [ "$_VIRTUALENV_DIR" != "null" ]; then - echoerror "Virtualenv installs via -V is only possible when installing salt via git" + echoerror "Virtualenv installs via -V is only possible when installing Salt via git" exit 1 fi fi @@ -569,14 +564,14 @@ if [ "$#" -gt 0 ]; then fi # Check the _DISABLE_SSL value and set HTTP or HTTPS. -if [ "$_DISABLE_SSL" -eq "${BS_TRUE}" ]; then +if [ "$_DISABLE_SSL" -eq $BS_TRUE ]; then HTTP_VAL="http" else HTTP_VAL="https" fi # Check the _QUIET_GIT_INSTALLATION value and set SETUP_PY_INSTALL_ARGS. -if [ "$_QUIET_GIT_INSTALLATION" -eq "${BS_TRUE}" ]; then +if [ "$_QUIET_GIT_INSTALLATION" -eq $BS_TRUE ]; then SETUP_PY_INSTALL_ARGS="-q" else SETUP_PY_INSTALL_ARGS="" @@ -590,7 +585,7 @@ else fi # Root permissions are required to run this script -if [ "$(${whoami})" != "root" ]; then +if [ "$($whoami)" != "root" ]; then echoerror "Salt requires root privileges to install. Please re-run this script as root." exit 1 fi @@ -610,14 +605,14 @@ if [ "${CALLER}x" = "${0}x" ]; then fi # Work around for 'Docker + salt-bootstrap failure' https://github.com/saltstack/salt-bootstrap/issues/394 -if [ ${_DISABLE_SALT_CHECKS} -eq $BS_FALSE ] && [ -f /tmp/disable_salt_checks ]; then +if [ "${_DISABLE_SALT_CHECKS}" -eq $BS_FALSE ] && [ -f /tmp/disable_salt_checks ]; then # shellcheck disable=SC2016 echowarn 'Found file: /tmp/disable_salt_checks, setting _DISABLE_SALT_CHECKS=$BS_TRUE' _DISABLE_SALT_CHECKS=$BS_TRUE fi # Because -a can only be installed into virtualenv -if ([ $_PIP_ALL -eq $BS_TRUE ] && [ "$_VIRTUALENV_DIR" = "null" ]); then +if [ "${_PIP_ALL}" -eq $BS_TRUE ] && [ "${_VIRTUALENV_DIR}" = "null" ]; then usage # Could possibly set up a default virtualenv location when -a flag is passed echoerror "Using -a requires -V because pip pkgs should be siloed from python system pkgs" @@ -625,7 +620,7 @@ if ([ $_PIP_ALL -eq $BS_TRUE ] && [ "$_VIRTUALENV_DIR" = "null" ]); then fi # Make sure virtualenv directory does not already exist -if [ -d "$_VIRTUALENV_DIR" ]; then +if [ -d "${_VIRTUALENV_DIR}" ]; then echoerror "The directory ${_VIRTUALENV_DIR} for virtualenv already exists" exit 1 fi @@ -723,8 +718,11 @@ exec 2>"$LOGPIPE" # Handle the insecure flags if [ "$_INSECURE_DL" -eq $BS_TRUE ]; then _CURL_ARGS="${_CURL_ARGS} --insecure" - _WGET_ARGS="${_WGET_ARGS} --no-check-certificate" _FETCH_ARGS="${_FETCH_ARGS} --no-verify-peer" + _GPG_ARGS="${_GPG_ARGS} --keyserver-options no-check-cert" + _WGET_ARGS="${_WGET_ARGS} --no-check-certificate" +else + _GPG_ARGS="${_GPG_ARGS} --keyserver-options ca-cert-file=/etc/ssl/certs/ca-certificates.crt" fi #--- FUNCTION ------------------------------------------------------------------------------------------------------- @@ -733,11 +731,11 @@ fi #---------------------------------------------------------------------------------------------------------------------- __fetch_url() { # shellcheck disable=SC2086 - curl $_CURL_ARGS -L -s -o "$1" "$2" >/dev/null 2>&1 || - wget $_WGET_ARGS -q -O "$1" "$2" >/dev/null 2>&1 || - fetch $_FETCH_ARGS -q -o "$1" "$2" >/dev/null 2>&1 || - fetch -q -o "$1" "$2" >/dev/null 2>&1 || # Pre FreeBSD 10 - ftp -o "$1" "$2" >/dev/null 2>&1 # OpenBSD + curl $_CURL_ARGS -L -s -o "$1" "$2" >/dev/null 2>&1 || + wget $_WGET_ARGS -q -O "$1" "$2" >/dev/null 2>&1 || + fetch $_FETCH_ARGS -q -o "$1" "$2" >/dev/null 2>&1 || # FreeBSD + fetch -q -o "$1" "$2" >/dev/null 2>&1 || # Pre FreeBSD 10 + ftp -o "$1" "$2" >/dev/null 2>&1 # OpenBSD } #--- FUNCTION ------------------------------------------------------------------------------------------------------- @@ -835,8 +833,10 @@ __derive_debian_numeric_version() { # I've found an EC2 wheezy image which did not tell its version NUMERIC_VERSION=$(__parse_version_string "7.0") elif [ "$INPUT_VERSION" = "jessie/sid" ]; then - # Let's start detecting the upcoming Debian 8 (Jessie) NUMERIC_VERSION=$(__parse_version_string "8.0") + elif [ "$INPUT_VERSION" = "stretch/sid" ]; then + # Let's start detecting the upcoming Debian 9 (Stretch) + NUMERIC_VERSION=$(__parse_version_string "9.0") else echowarn "Unable to parse the Debian Version (codename: '$INPUT_VERSION')" fi @@ -850,15 +850,15 @@ __derive_debian_numeric_version() { # DESCRIPTION: Strip single or double quotes from the provided string. #---------------------------------------------------------------------------------------------------------------------- __unquote_string() { - echo "${@}" | sed "s/^\([\"']\)\(.*\)\1\$/\2/g" + echo "$*" | sed -e "s/^\([\"']\)\(.*\)\1\$/\2/g" } #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: __camelcase_split -# DESCRIPTION: Convert CamelCased strings to Camel_Cased +# DESCRIPTION: Convert 'CamelCased' strings to 'Camel Cased' #---------------------------------------------------------------------------------------------------------------------- __camelcase_split() { - echo "${@}" | sed -r 's/([^A-Z-])([A-Z])/\1 \2/g' + echo "$*" | sed -e 's/\([^[:upper:][:punct:]]\)\([[:upper:]]\)/\1 \2/g' } #--- FUNCTION ------------------------------------------------------------------------------------------------------- @@ -866,7 +866,7 @@ __camelcase_split() { # DESCRIPTION: Strip duplicate strings #---------------------------------------------------------------------------------------------------------------------- __strip_duplicates() { - echo "${@}" | tr -s '[:space:]' '\n' | awk '!x[$0]++' + echo "$*" | tr -s '[:space:]' '\n' | awk '!x[$0]++' } #--- FUNCTION ------------------------------------------------------------------------------------------------------- @@ -924,9 +924,12 @@ __gather_linux_system_info() { DISTRO_NAME=$(lsb_release -si) if [ "${DISTRO_NAME}" = "Scientific" ]; then DISTRO_NAME="Scientific Linux" - elif [ "$(echo "$DISTRO_NAME" | grep RedHat)" != "" ]; then - # Let's convert CamelCase to Camel Case - DISTRO_NAME=$(__camelcase_split "$DISTRO_NAME") + elif [ "$(echo "$DISTRO_NAME" | grep ^RedHat)" != "" ]; then + # Let's convert 'CamelCased' to 'Camel Cased' + n=$(__camelcase_split "$DISTRO_NAME") + # Skip setting DISTRO_NAME this time, splitting CamelCase has failed. + # See https://github.com/saltstack/salt-bootstrap/issues/918 + [ "$n" = "$DISTRO_NAME" ] && DISTRO_NAME="" || DISTRO_NAME="$n" elif [ "${DISTRO_NAME}" = "openSUSE project" ]; then # lsb_release -si returns "openSUSE project" on openSUSE 12.3 DISTRO_NAME="opensuse" @@ -951,6 +954,8 @@ __gather_linux_system_info() { return elif [ "${DISTRO_NAME}" = "Raspbian" ]; then DISTRO_NAME="Debian" + elif [ "${DISTRO_NAME}" = "Cumulus Linux" ]; then + DISTRO_NAME="Debian" fi rv=$(lsb_release -sr) [ "${rv}" != "" ] && DISTRO_VERSION=$(__parse_version_string "$rv") @@ -1234,7 +1239,6 @@ __ubuntu_derivatives_translation() { #---------------------------------------------------------------------------------------------------------------------- # shellcheck disable=SC2034 __ubuntu_codename_translation() { - case $DISTRO_MINOR_VERSION in "04") _april="yes" @@ -1282,12 +1286,14 @@ __debian_derivatives_translation() { # If the file does not exist, return [ ! -f /etc/os-release ] && return - DEBIAN_DERIVATIVES="(kali|linuxmint)" + DEBIAN_DERIVATIVES="(kali|linuxmint|cumulus-linux)" # Mappings kali_1_debian_base="7.0" linuxmint_1_debian_base="8.0" + cumulus_2_debian_base="7.0" + cumulus_3_debian_base="8.0" - # Detect derivates, Kali and LinuxMint *only* for now + # Detect derivates, Cumulus Linux, Kali and LinuxMint *only* for now rv=$(grep ^ID= /etc/os-release | sed -e 's/.*=//') # Translate Debian derivatives to their base Debian version @@ -1303,6 +1309,10 @@ __debian_derivatives_translation() { _major=$(echo "$DISTRO_VERSION" | sed 's/^\([0-9]*\).*/\1/g') _debian_derivative="linuxmint" ;; + cumulus-linux) + _major=$(echo "$DISTRO_VERSION" | sed 's/^\([0-9]*\).*/\1/g') + _debian_derivative="cumulus" + ;; esac _debian_version=$(eval echo "\$${_debian_derivative}_${_major}_debian_base") @@ -1315,20 +1325,20 @@ __debian_derivatives_translation() { fi } + #--- FUNCTION ------------------------------------------------------------------------------------------------------- -# NAME: __set_suse_pkg_repo -# DESCRIPTION: Set SUSE_PKG_URL to either the upstream SaltStack repo or the -# downstream SUSE repo +# NAME: __check_and_refresh_suse_pkg_repo +# DESCRIPTION: Check if zypper knows about systemsmanagement_saltstack repo yet. +# If it doesn't, add the repo and refresh with the SUSE_PKG_URL. #---------------------------------------------------------------------------------------------------------------------- -__set_suse_pkg_repo() { - suse_pkg_url_path="${DISTRO_REPO}/systemsmanagement:saltstack.repo" - if [ "$_DOWNSTREAM_PKG_REPO" -eq $BS_TRUE ]; then - # FIXME: cleartext download over unsecure protocol (HTTP) - suse_pkg_url_base="http://download.opensuse.org/repositories/systemsmanagement:saltstack" - else - suse_pkg_url_base="${HTTP_VAL}://repo.saltstack.com/opensuse" +__check_and_refresh_suse_pkg_repo() { + # Check to see if systemsmanagement_saltstack exists + __zypper repos | grep systemsmanagement_saltstack >/dev/null 2>&1 + + if [ $? -eq 1 ]; then + # zypper does not yet know anything about systemsmanagement_saltstack + __zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1 fi - SUSE_PKG_URL="$suse_pkg_url_base/$suse_pkg_url_path" } __gather_system_info @@ -1442,6 +1452,7 @@ if ([ "${DISTRO_NAME_L}" != "ubuntu" ] && [ $_PIP_ALL -eq $BS_TRUE ]);then echoerror "${DISTRO_NAME} does not have -a support" exit 1 fi + #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: __function_defined # DESCRIPTION: Checks if a function is defined within this scripts scope @@ -1459,6 +1470,89 @@ __function_defined() { } +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: __apt_get_install_noinput +# DESCRIPTION: (DRY) apt-get install with noinput options +# PARAMETERS: packages +#---------------------------------------------------------------------------------------------------------------------- +__apt_get_install_noinput() { + apt-get install -y -o DPkg::Options::=--force-confold "${@}"; return $? +} # ---------- end of function __apt_get_install_noinput ---------- + + +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: __apt_get_upgrade_noinput +# DESCRIPTION: (DRY) apt-get upgrade with noinput options +#---------------------------------------------------------------------------------------------------------------------- +__apt_get_upgrade_noinput() { + apt-get upgrade -y -o DPkg::Options::=--force-confold; return $? +} # ---------- end of function __apt_get_upgrade_noinput ---------- + + +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: __apt_key_fetch +# DESCRIPTION: Download and import GPG public key for "apt-secure" +# PARAMETERS: url +#---------------------------------------------------------------------------------------------------------------------- +__apt_key_fetch() { + url=$1 + + __apt_get_install_noinput gnupg-curl || return 1 + + # shellcheck disable=SC2086 + apt-key adv ${_GPG_ARGS} --fetch-keys "$url"; return $? +} # ---------- end of function __apt_key_fetch ---------- + + +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: __rpm_import_gpg +# DESCRIPTION: Download and import GPG public key to rpm database +# PARAMETERS: url +#---------------------------------------------------------------------------------------------------------------------- +__rpm_import_gpg() { + url=$1 + + if __check_command_exists mktemp; then + tempfile="$(mktemp /tmp/salt-gpg-XXXXXXXX.pub 2>/dev/null)" + + if [ -z "$tempfile" ]; then + echoerror "Failed to create temporary file in /tmp" + return 1 + fi + else + tempfile="/tmp/salt-gpg-$$.pub" + fi + + __fetch_url "$tempfile" "$url" || return 1 + rpm --import "$tempfile" || return 1 + rm -f "$tempfile" + + return 0 +} # ---------- end of function __rpm_import_gpg ---------- + + +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: __yum_install_noinput +# DESCRIPTION: (DRY) yum install with noinput options +#---------------------------------------------------------------------------------------------------------------------- +__yum_install_noinput() { + + ENABLE_EPEL_CMD="" + if [ $_DISABLE_REPOS -eq $BS_TRUE ]; then + ENABLE_EPEL_CMD="--enablerepo=${_EPEL_REPO}" + fi + + if [ "$DISTRO_NAME_L" = "oracle_linux" ]; then + # We need to install one package at a time because --enablerepo=X disables ALL OTHER REPOS!!!! + for package in "${@}"; do + yum -y install "${package}" || yum -y install "${package}" ${ENABLE_EPEL_CMD} || return $? + done + else + yum -y install "${@}" ${ENABLE_EPEL_CMD} || return $? + fi +} # ---------- end of function __yum_install_noinput ---------- + + #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: __git_clone_and_checkout # DESCRIPTION: (DRY) Helper function to clone and checkout salt to a @@ -1550,8 +1644,7 @@ __git_clone_and_checkout() { # shellcheck disable=SC2164 cd "${_SALT_GIT_CHECKOUT_DIR}" - if ! echo "$_SALT_REPO_URL" | \ - grep -q -x '\(\(git\|https\)://github\.com/\|git@github\.com:\)saltstack/salt\.git'; then + if ! echo "$_SALT_REPO_URL" | grep -q -F -w "${_SALTSTACK_REPO_URL#*://}"; then # We need to add the saltstack repository as a remote and fetch tags for proper versioning echoinfo "Adding SaltStack's Salt repository as a remote" git remote add upstream "$_SALTSTACK_REPO_URL" || return 1 @@ -1576,46 +1669,6 @@ __git_clone_and_checkout() { } -#--- FUNCTION ------------------------------------------------------------------------------------------------------- -# NAME: __apt_get_install_noinput -# DESCRIPTION: (DRY) apt-get install with noinput options -#---------------------------------------------------------------------------------------------------------------------- -__apt_get_install_noinput() { - apt-get install -y -o DPkg::Options::=--force-confold "${@}"; return $? -} - - -#--- FUNCTION ------------------------------------------------------------------------------------------------------- -# NAME: __apt_get_upgrade_noinput -# DESCRIPTION: (DRY) apt-get upgrade with noinput options -#---------------------------------------------------------------------------------------------------------------------- -__apt_get_upgrade_noinput() { - apt-get upgrade -y -o DPkg::Options::=--force-confold; return $? -} - - -#--- FUNCTION ------------------------------------------------------------------------------------------------------- -# NAME: __yum_install_noinput -# DESCRIPTION: (DRY) apt-get install with noinput options -#---------------------------------------------------------------------------------------------------------------------- -__yum_install_noinput() { - - ENABLE_EPEL_CMD="" - if [ $_DISABLE_REPOS -eq $BS_TRUE ]; then - ENABLE_EPEL_CMD="--enablerepo=${_EPEL_REPO}" - fi - - if [ "$DISTRO_NAME_L" = "oracle_linux" ]; then - # We need to install one package at a time because --enablerepo=X disables ALL OTHER REPOS!!!! - for package in "${@}"; do - yum -y install "${package}" || yum -y install "${package}" ${ENABLE_EPEL_CMD} || return $? - done - else - yum -y install "${@}" ${ENABLE_EPEL_CMD} || return $? - fi -} - - #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: __check_end_of_life_versions # DESCRIPTION: Check for end of life distribution versions @@ -1908,20 +1961,24 @@ __overwriteconfig() { tempfile="/tmp/salt-config-$$" fi - # Convert json string to a yaml string and write it to config file. Output is dumped into tempfile. - python -c "import json; import yaml; jsn=json.loads('$json'); yml=yaml.safe_dump(jsn, line_break='\n', default_flow_style=False); config_file=open('$target', 'w'); config_file.write(yml); config_file.close();" 2>$tempfile + # If python does not have yaml installed we're on Arch and should use python2 + if python -c "import yaml" 2> /dev/null; then + good_python=python + else + good_python=python2 + fi - # Check if there were any errors output to the tempfile - filesize=$(python -c "import os; print os.stat('$tempfile').st_size;") + # Convert json string to a yaml string and write it to config file. Output is dumped into tempfile. + $good_python -c "import json; import yaml; jsn=json.loads('$json'); yml=yaml.safe_dump(jsn, line_break='\n', default_flow_style=False); config_file=open('$target', 'w'); config_file.write(yml); config_file.close();" 2>$tempfile # No python errors output to the tempfile - if [ "$filesize" -eq 0 ]; then + if [ ! -s "$tempfile" ]; then rm -f "$tempfile" return 0 fi - # Errors are present in the tempfile - let's expose the that to the user. - fullerror=$(python -c "tmp_file=open('$tempfile'); print tmp_file.read(); tmp_file.close()") + # Errors are present in the tempfile - let's expose them to the user. + fullerror=$(cat "$tempfile") echodebug "$fullerror" echoerror "Python error encountered. This is likely due to passing in a malformed JSON string. Please use -D to see stacktrace." @@ -1931,33 +1988,6 @@ __overwriteconfig() { } -#--- FUNCTION ------------------------------------------------------------------------------------------------------- -# NAME: __rpm_import_gpg -# DESCRIPTION: Download and import GPG public key to rpm database -# PARAMETERS: url -#---------------------------------------------------------------------------------------------------------------------- -__rpm_import_gpg() { - url="$1" - - if __check_command_exists mktemp; then - tempfile="$(mktemp /tmp/salt-gpg-XXXXXXXX.pub 2>/dev/null)" - - if [ -z "$tempfile" ]; then - echoerror "Failed to create temporary file in /tmp" - return 1 - fi - else - tempfile="/tmp/salt-gpg-$$.pub" - fi - - __fetch_url "$tempfile" "$url" || return 1 - rpm --import "$tempfile" || return 1 - rm -f "$tempfile" - - return 0 -} - - #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: __check_services_systemd # DESCRIPTION: Return 0 or 1 in case the service is enabled or not @@ -2083,12 +2113,12 @@ __check_services_openbsd() { echodebug "Checking if service ${servicename} is enabled" # shellcheck disable=SC2086,SC2046,SC2144 - if [ -f /etc/rc.d/${servicename} ] && [ $(grep ${servicename} /etc/rc.conf.local) -ne "" ] ; then + if rcctl get ${servicename} status; then echodebug "Service ${servicename} is enabled" return 0 else echodebug "Service ${servicename} is NOT enabled" - # return 1 + return 1 fi } # ---------- end of function __check_services_openbsd ---------- @@ -2131,7 +2161,7 @@ __activate_virtualenv() { #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: __install_pip_deps # DESCRIPTION: Return 0 or 1 if successfully able to install pip packages via requirements file -# PARAMETERS: requirements_files +# PARAMETERS: requirements_file #---------------------------------------------------------------------------------------------------------------------- __install_pip_deps() { # Install virtualenv to system pip before activating virtualenv if thats going to be used @@ -2161,7 +2191,7 @@ __install_pip_deps() { # shellcheck disable=SC2086,SC2090 pip install -U -r ${requirements_file} ${__PIP_PACKAGES} -} +} # ---------- end of function __install_pip_deps ---------- ####################################################################################################################### @@ -2270,8 +2300,6 @@ __enable_universe_repository() { } install_ubuntu_deps() { - apt-get update - if [ "$DISTRO_MAJOR_VERSION" -gt 12 ] || ([ "$DISTRO_MAJOR_VERSION" -eq 12 ] && [ "$DISTRO_MINOR_VERSION" -eq 10 ]); then # Above Ubuntu 12.04 add-apt-repository is in a different package __apt_get_install_noinput software-properties-common || return 1 @@ -2324,10 +2352,6 @@ install_ubuntu_deps() { # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 __PACKAGES="${__PACKAGES} procps pciutils" - if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then - __apt_get_upgrade_noinput || return 1 - fi - # shellcheck disable=SC2086,SC2090 __apt_get_install_noinput ${__PACKAGES} || return 1 @@ -2357,12 +2381,17 @@ install_ubuntu_stable_deps() { apt-get update - # Install Keys - __apt_get_install_noinput debian-archive-keyring && apt-get update + if [ "${_UPGRADE_SYS}" -eq $BS_TRUE ]; then + if [ "${_INSECURE_DL}" -eq $BS_TRUE ]; then + __apt_get_install_noinput --allow-unauthenticated debian-archive-keyring && + apt-key update && apt-get update + fi - if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + __apt_get_upgrade_noinput || return 1 + fi + + if [ ${_DISABLE_REPOS} -eq $BS_FALSE ]; then __get_dpkg_architecture || return 1 - __REPO_ARCH="$DPKG_ARCHITECTURE" if [ "$DPKG_ARCHITECTURE" = "i386" ]; then @@ -2392,26 +2421,14 @@ install_ubuntu_stable_deps() { # SaltStack's stable Ubuntu repository: SALTSTACK_UBUNTU_URL="${HTTP_VAL}://repo.saltstack.com/apt/ubuntu/${UBUNTU_VERSION}/${__REPO_ARCH}/${STABLE_REV}" - - apt-get update + echo "deb $SALTSTACK_UBUNTU_URL $UBUNTU_CODENAME main" > /etc/apt/sources.list.d/saltstack.list # Make sure https transport is available if [ "$HTTP_VAL" = "https" ] ; then - __apt_get_install_noinput ca-certificates apt-transport-https || return 1 + __apt_get_install_noinput apt-transport-https ca-certificates || return 1 fi - # Make sure wget is available - __apt_get_install_noinput wget - - if [ "$(grep -ER 'latest .+ main' /etc/apt)" = "" ]; then - set +o nounset - echo "deb $SALTSTACK_UBUNTU_URL $UBUNTU_CODENAME main" > "/etc/apt/sources.list.d/saltstack.list" - set -o nounset - fi - - # shellcheck disable=SC2086 - wget $_WGET_ARGS -q $SALTSTACK_UBUNTU_URL/SALTSTACK-GPG-KEY.pub -O - | apt-key add - || return 1 - + __apt_key_fetch "$SALTSTACK_UBUNTU_URL/SALTSTACK-GPG-KEY.pub" || return 1 else # Alternate PPAs: salt16, salt17, salt2014-1, salt2014-7 if [ ! "$(echo "$STABLE_REV" | egrep '^(1\.6|1\.7)$')" = "" ]; then @@ -2429,6 +2446,8 @@ install_ubuntu_stable_deps() { add-apt-repository "ppa:$STABLE_PPA" || return 1 fi fi + + apt-get update fi install_ubuntu_deps || return 1 @@ -2488,7 +2507,7 @@ install_ubuntu_git_deps() { else install_ubuntu_stable_deps || return 1 - __PACKAGES="${__PACKAGES} python-crypto python-jinja2 python-m2crypto python-msgpack python-requests" + __PACKAGES="${__PACKAGES} python-crypto python-jinja2 python-msgpack python-requests" __PACKAGES="${__PACKAGES} python-tornado python-yaml python-zmq" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then @@ -2556,14 +2575,13 @@ install_ubuntu_stable_post() { return 0 fi - for fname in minion master syndic api; do - # Skip if not meant to be installed + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue + # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ]; then @@ -2579,17 +2597,18 @@ install_ubuntu_stable_post() { fi done } -install_ubuntu_git_post() { - for fname in minion master syndic api; do +install_ubuntu_git_post() { + for fname in api master minion syndic; do # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "api" ] && \ + ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ] && [ "$DISTRO_MAJOR_VERSION" -ge 15 ]; then - __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service" + __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/deb/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service" # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue @@ -2638,14 +2657,14 @@ install_ubuntu_restart_daemons() { elif [ -f /sbin/initctl ]; then /sbin/initctl reload-configuration fi - for fname in minion master syndic api; do + + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ] && [ "$DISTRO_MAJOR_VERSION" -ge 15 ]; then @@ -2683,14 +2702,13 @@ install_ubuntu_restart_daemons() { } install_ubuntu_check_services() { - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ] && [ "$DISTRO_MAJOR_VERSION" -ge 15 ]; then @@ -2701,6 +2719,7 @@ install_ubuntu_check_services() { __check_services_debian salt-$fname || return 1 fi done + return 0 } # @@ -2722,8 +2741,15 @@ install_debian_deps() { apt-get update - # Install Keys - __apt_get_install_noinput debian-archive-keyring && apt-get update + if [ "${_UPGRADE_SYS}" -eq $BS_TRUE ]; then + # Try to update GPG keys first if allowed + if [ "${_INSECURE_DL}" -eq $BS_TRUE ]; then + __apt_get_install_noinput --allow-unauthenticated debian-archive-keyring && + apt-key update && apt-get update + fi + + __apt_get_upgrade_noinput || return 1 + fi # Install procps and pciutils which allows for Docker bootstraps. See #366#issuecomment-39666813 __PACKAGES="procps pciutils" @@ -2732,6 +2758,12 @@ install_debian_deps() { # shellcheck disable=SC2086 __apt_get_install_noinput ${__PACKAGES} || return 1 + if [ "${_EXTRA_PACKAGES}" != "" ]; then + echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" + # shellcheck disable=SC2086 + __apt_get_install_noinput ${_EXTRA_PACKAGES} || return 1 + fi + if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then # shellcheck disable=SC2089 __PIP_PACKAGES="${__PIP_PACKAGES} 'apache-libcloud>=$_LIBCLOUD_MIN_VERSION'" @@ -2742,16 +2774,6 @@ install_debian_deps() { pip install -U ${__PIP_PACKAGES} || return 1 fi - if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then - __apt_get_upgrade_noinput || return 1 - fi - - if [ "${_EXTRA_PACKAGES}" != "" ]; then - echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" - # shellcheck disable=SC2086 - __apt_get_install_noinput ${_EXTRA_PACKAGES} || return 1 - fi - return 0 } @@ -2765,18 +2787,17 @@ install_debian_7_deps() { apt-get update - # Install Keys - __apt_get_install_noinput debian-archive-keyring && apt-get update + if [ "${_UPGRADE_SYS}" -eq $BS_TRUE ]; then + # Try to update GPG keys first if allowed + if [ "${_INSECURE_DL}" -eq $BS_TRUE ]; then + __apt_get_install_noinput --allow-unauthenticated debian-archive-keyring && + apt-key update && apt-get update + fi - # Install Debian Archive Automatic Signing Key (7.0/wheezy), see #557 - if [ "$(apt-key finger | grep 'A1BD 8E9D 78F7 FE5C 3E65 D8AF 8B48 AD62 4692 5553')" = "" ]; then - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553 || return 1 + __apt_get_upgrade_noinput || return 1 fi - # Make sure wget is available - __apt_get_install_noinput wget || return 1 - - if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + if [ "${_DISABLE_REPOS}" -eq $BS_FALSE ]; then __get_dpkg_architecture || return 1 __REPO_ARCH="$DPKG_ARCHITECTURE" @@ -2802,32 +2823,27 @@ install_debian_7_deps() { echo "deb $SALTSTACK_DEBIAN_URL wheezy main" > "/etc/apt/sources.list.d/saltstack.list" if [ "$HTTP_VAL" = "https" ] ; then - __apt_get_install_noinput ca-certificates apt-transport-https || return 1 + __apt_get_install_noinput apt-transport-https ca-certificates || return 1 fi - # shellcheck disable=SC2086 - wget $_WGET_ARGS -q "$SALTSTACK_DEBIAN_URL/SALTSTACK-GPG-KEY.pub" -O - | apt-key add - || return 1 + __apt_key_fetch "$SALTSTACK_DEBIAN_URL/SALTSTACK-GPG-KEY.pub" || return 1 elif [ -n "$STABLE_REV" ]; then echoerror "Installation of Salt ${STABLE_REV#*/} packages not supported by ${__ScriptName} ${__ScriptVersion} on Debian $DISTRO_MAJOR_VERSION." return 1 fi + + apt-get update else echowarn "Packages from repo.saltstack.com are required to install Salt version 2015.8 or higher on Debian $DISTRO_MAJOR_VERSION." fi - apt-get update || return 1 - # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 __PACKAGES='procps pciutils' # shellcheck disable=SC2086 __apt_get_install_noinput ${__PACKAGES} || return 1 - if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then - __apt_get_upgrade_noinput || return 1 - fi - if [ "${_EXTRA_PACKAGES}" != "" ]; then echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" # shellcheck disable=SC2086 @@ -2847,18 +2863,17 @@ install_debian_8_deps() { apt-get update - # Install Keys - __apt_get_install_noinput debian-archive-keyring && apt-get update + if [ "${_UPGRADE_SYS}" -eq $BS_TRUE ]; then + # Try to update GPG keys first if allowed + if [ "${_INSECURE_DL}" -eq $BS_TRUE ]; then + __apt_get_install_noinput --allow-unauthenticated debian-archive-keyring && + apt-key update && apt-get update + fi - # Install Debian Archive Automatic Signing Key (8/jessie), see #557 - if [ "$(apt-key finger | grep '126C 0D24 BD8A 2942 CC7D F8AC 7638 D044 2B90 D010')" = "" ]; then - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010 || return 1 + __apt_get_upgrade_noinput || return 1 fi - # Make sure wget is available - __apt_get_install_noinput wget || return 1 - - if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + if [ ${_DISABLE_REPOS} -eq $BS_FALSE ]; then __get_dpkg_architecture || return 1 __REPO_ARCH="$DPKG_ARCHITECTURE" @@ -2886,19 +2901,18 @@ install_debian_8_deps() { echo "deb $SALTSTACK_DEBIAN_URL jessie main" > "/etc/apt/sources.list.d/saltstack.list" if [ "$HTTP_VAL" = "https" ] ; then - __apt_get_install_noinput ca-certificates apt-transport-https || return 1 + __apt_get_install_noinput apt-transport-https ca-certificates || return 1 fi - # shellcheck disable=SC2086 - wget $_WGET_ARGS -q "$SALTSTACK_DEBIAN_URL/SALTSTACK-GPG-KEY.pub" -O - | apt-key add - || return 1 + __apt_key_fetch "$SALTSTACK_DEBIAN_URL/SALTSTACK-GPG-KEY.pub" || return 1 elif [ -n "$STABLE_REV" ]; then echoerror "Installation of Salt ${STABLE_REV#*/} packages not supported by ${__ScriptName} ${__ScriptVersion} on Debian $DISTRO_MAJOR_VERSION." return 1 fi - fi - apt-get update || return 1 + apt-get update + fi # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 __PACKAGES='procps pciutils' @@ -2927,7 +2941,7 @@ install_debian_git_deps() { __git_clone_and_checkout || return 1 __PACKAGES="libzmq3 libzmq3-dev lsb-release python-apt python-backports.ssl-match-hostname python-crypto" - __PACKAGES="${__PACKAGES} python-jinja2 python-m2crypto python-msgpack python-requests python-tornado" + __PACKAGES="${__PACKAGES} python-jinja2 python-msgpack python-requests python-tornado" __PACKAGES="${__PACKAGES} python-tornado python-yaml python-zmq" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then @@ -2963,7 +2977,7 @@ install_debian_8_git_deps() { __git_clone_and_checkout || return 1 - __PACKAGES='libzmq3 libzmq3-dev lsb-release python-apt python-crypto python-jinja2 python-m2crypto python-msgpack python-requests python-yaml python-zmq' + __PACKAGES='libzmq3 libzmq3-dev lsb-release python-apt python-crypto python-jinja2 python-msgpack python-requests python-yaml python-zmq' if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then # Install python-libcloud if asked to @@ -3063,7 +3077,7 @@ install_debian_8_git() { } install_debian_git_post() { - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip if not meant to be installed [ "$fname" = "api" ] && \ ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue @@ -3092,12 +3106,14 @@ install_debian_git_post() { SYSTEMD_RELOAD=$BS_TRUE # Install initscripts for Debian 7 "Wheezy" - elif [ ! -f /etc/init.d/salt-$fname ] || \ - ([ -f /etc/init.d/salt-$fname ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then + elif [ ! -f "/etc/init.d/salt-$fname" ] || \ + ([ -f "/etc/init.d/salt-$fname" ] && [ "$_FORCE_OVERWRITE" -eq $BS_TRUE ]); then if [ -f "${_SALT_GIT_CHECKOUT_DIR}/pkg/deb/salt-$fname.init" ]; then __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/deb/salt-${fname}.init" "/etc/init.d/salt-${fname}" __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/deb/salt-${fname}.environment" "/etc/default/salt-${fname}" else + # Make sure wget is available + __check_command_exists wget || __apt_get_install_noinput wget || return 1 __fetch_url "/etc/init.d/salt-${fname}" "${HTTP_VAL}://anonscm.debian.org/cgit/pkg-salt/salt.git/plain/debian/salt-${fname}.init" fi @@ -3113,22 +3129,21 @@ install_debian_git_post() { update-rc.d "salt-${fname}" defaults fi - done } install_debian_restart_daemons() { [ "$_START_DAEMONS" -eq $BS_FALSE ] && return 0 - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ ! -f "/etc/init.d/salt-$fname" ]) && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue + if [ -f /bin/systemctl ]; then # Debian 8 uses systemd /bin/systemctl stop salt-$fname > /dev/null 2>&1 @@ -3142,7 +3157,7 @@ install_debian_restart_daemons() { } install_debian_check_services() { - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue @@ -3188,7 +3203,7 @@ install_fedora_deps() { __install_saltstack_copr_salt_repository || return 1 fi - __PACKAGES="yum-utils PyYAML libyaml m2crypto python-crypto python-jinja2 python-zmq" + __PACKAGES="yum-utils PyYAML libyaml python-crypto python-jinja2 python-zmq" if [ "$DISTRO_MAJOR_VERSION" -ge 23 ]; then __PACKAGES="${__PACKAGES} python2-msgpack python2-requests" @@ -3236,7 +3251,7 @@ install_fedora_stable() { } install_fedora_stable_post() { - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue @@ -3310,12 +3325,12 @@ install_fedora_git() { } install_fedora_git_post() { - for fname in minion master syndic api; do - + for fname in api master minion syndic; do # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "api" ] && \ + ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service" @@ -3332,14 +3347,13 @@ install_fedora_git_post() { install_fedora_restart_daemons() { [ $_START_DAEMONS -eq $BS_FALSE ] && return - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue systemctl stop salt-$fname > /dev/null 2>&1 @@ -3348,17 +3362,18 @@ install_fedora_restart_daemons() { } install_fedora_check_services() { - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue + __check_services_systemd salt-$fname || return 1 done + return 0 } # @@ -3376,7 +3391,7 @@ __install_epel_repository() { fi # Check if epel repo is already enabled and flag it accordingly - yum repolist | grep -q "^[!]${_EPEL_REPO}/" + yum repolist | grep -q "^[!]\?${_EPEL_REPO}/" if [ $? -eq 0 ]; then _EPEL_REPOS_INSTALLED=$BS_TRUE return 0 @@ -3589,10 +3604,10 @@ install_centos_git_deps() { __PACKAGES="" if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then - __PACKAGES="${__PACKAGES} python26-PyYAML python26-m2crypto m2crypto python26 python26-requests" + __PACKAGES="${__PACKAGES} python26-PyYAML python26 python26-requests" __PACKAGES="${__PACKAGES} python26-crypto python26-jinja2 python26-msgpack python26-tornado python26-zmq" else - __PACKAGES="${__PACKAGES} PyYAML m2crypto python-crypto python-msgpack python-zmq python-jinja2" + __PACKAGES="${__PACKAGES} PyYAML python-crypto python-futures python-msgpack python-zmq python-jinja2" __PACKAGES="${__PACKAGES} python-requests python-tornado" fi @@ -4105,7 +4120,7 @@ _eof fi fi - __PACKAGES="PyYAML m2crypto python-crypto python-msgpack python-zmq python26-ordereddict python-jinja2 python-requests" + __PACKAGES="PyYAML python-crypto python-msgpack python-zmq python26-ordereddict python-jinja2 python-requests" # shellcheck disable=SC2086 yum -y install ${__PACKAGES} ${ENABLE_EPEL_CMD} || return 1 @@ -4247,7 +4262,7 @@ install_arch_linux_git_deps() { fi pacman -R --noconfirm python2-distribute pacman -Sy --noconfirm --needed python2-crypto python2-setuptools python2-jinja \ - python2-m2crypto python2-markupsafe python2-msgpack python2-psutil python2-yaml \ + python2-markupsafe python2-msgpack python2-psutil python2-yaml \ python2-pyzmq zeromq python2-requests python2-systemd || return 1 __git_clone_and_checkout || return 1 @@ -4292,12 +4307,12 @@ install_arch_linux_git() { } install_arch_linux_post() { - for fname in minion master syndic api; do - + for fname in api master minion syndic; do # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "api" ] && \ + ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue # Since Arch's pacman renames configuration files @@ -4327,13 +4342,12 @@ install_arch_linux_post() { } install_arch_linux_git_post() { - for fname in minion master syndic api; do - + for fname in api master minion syndic; do # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue - [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue [ $fname = "api" ] && \ ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /usr/bin/systemctl ]; then @@ -4360,7 +4374,7 @@ install_arch_linux_git_post() { install_arch_linux_restart_daemons() { [ $_START_DAEMONS -eq $BS_FALSE ] && return - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue @@ -4374,6 +4388,7 @@ install_arch_linux_restart_daemons() { /usr/bin/systemctl start salt-$fname.service continue fi + /etc/rc.d/salt-$fname stop > /dev/null 2>&1 /etc/rc.d/salt-$fname start done @@ -4385,7 +4400,7 @@ install_arch_check_services() { return 0 fi - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue @@ -4396,6 +4411,7 @@ install_arch_check_services() { __check_services_systemd salt-$fname || return 1 done + return 0 } # @@ -4407,10 +4423,6 @@ install_arch_check_services() { # # FreeBSD Install Functions # -config_freebsd_salt() { - _SALT_ETC_DIR=${BS_SALT_ETC_DIR:-/usr/local/etc/salt} - config_salt -} __freebsd_get_packagesite() { if [ "$CPU_ARCH_L" = "amd64" ]; then @@ -4479,6 +4491,8 @@ __configure_freebsd_pkg_details() { } install_freebsd_9_stable_deps() { + _SALT_ETC_DIR=${BS_SALT_ETC_DIR:-/usr/local/etc/salt} + _PKI_DIR=${_SALT_ETC_DIR}/pki if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then #make variables available even if pkg already installed @@ -4574,10 +4588,6 @@ install_freebsd_git_deps() { _TEMP_CONFIG_DIR="${_SALT_GIT_CHECKOUT_DIR}/conf/" CONFIG_SALT_FUNC="config_salt" - # Set _SALT_ETC_DIR to ports default - _SALT_ETC_DIR=${BS_SALT_ETC_DIR:-/usr/local/etc/salt} - # We also need to redefine the PKI directory - _PKI_DIR=${_SALT_ETC_DIR}/pki fi return 0 @@ -4600,13 +4610,6 @@ install_freebsd_11_stable() { # shellcheck disable=SC2086 /usr/local/sbin/pkg install ${FROM_FREEBSD} -y sysutils/py-salt || return 1 -# -# setting _SALT_ETC_DIR to match paths from FreeBSD ports: -# - _SALT_ETC_DIR=${BS_SALT_ETC_DIR:-/usr/local/etc/salt} - if [ ! -d /etc/salt ]; then - ln -sf "${_SALT_ETC_DIR}" /etc/salt - fi return 0 } @@ -4651,15 +4654,13 @@ install_freebsd_git() { } install_freebsd_9_stable_post() { - for fname in minion master syndic api; do - + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue enable_string="salt_${fname}_enable=\"YES\"" @@ -4670,7 +4671,6 @@ install_freebsd_9_stable_post() { grep "salt_minion_paths" /etc/rc.conf >/dev/null 2>&1 [ $? -eq 1 ] && echo "salt_minion_paths=\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin\"" >> /etc/rc.conf fi - done } @@ -4690,14 +4690,13 @@ install_freebsd_git_post() { install_freebsd_restart_daemons() { [ $_START_DAEMONS -eq $BS_FALSE ] && return - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue service salt_$fname stop > /dev/null 2>&1 @@ -4715,82 +4714,34 @@ install_freebsd_restart_daemons() { # __choose_openbsd_mirror() { - # FIXME: cleartext download over unsecure protocol (HTTP) - MIRRORS_LIST_URL=http://www.openbsd.org/ftp.html - MIRROR_LIST_FILE=/tmp/openbsd-mirrors.html OPENBSD_REPO='' MINTIME='' + MIRROR_LIST=$(awk -F= '/installpath = / {print $2}' /etc/examples/pkg.conf) - __fetch_url "$MIRROR_LIST_FILE" "$MIRRORS_LIST_URL" || return 1 - MIRRORS_LIST=$(grep href "$MIRROR_LIST_FILE" | grep http | grep pub | awk -F \" '{ print $2 }') - [ -n "$MIRRORS_LIST" ] && rm -f "$MIRROR_LIST_FILE" - - echoinfo "Getting list of mirrors from $MIRRORS_LIST_URL" - for MIRROR in $MIRRORS_LIST; do - MIRROR_HOST=$(echo "$MIRROR" | awk -F / '{ print $3 }') - TIME=$(ping -c 1 -q "$MIRROR_HOST" | grep round-trip | awk -F / '{ print $5 }') + for MIRROR in $MIRROR_LIST; do + MIRROR_HOST=$(echo "$MIRROR" | sed -e 's|.*//||' -e 's|+*/.*$||') + TIME=$(ping -c 1 -w 1 -q "$MIRROR_HOST" | awk -F/ '/round-trip/ { print $5 }') [ -z "$TIME" ] && continue - echodebug "ping time for $MIRROR is $TIME" - [ -z "$MINTIME" ] && MINTIME=$TIME - - FASTER_MIRROR=$(echo "$TIME < $MINTIME" | bc) + echodebug "ping time for $MIRROR_HOST is $TIME" + if [ -z "$MINTIME" ]; then + FASTER_MIRROR=1 + else + FASTER_MIRROR=$(echo "$TIME < $MINTIME" | bc) + fi if [ "$FASTER_MIRROR" -eq 1 ]; then MINTIME=$TIME - OPENBSD_REPO=$MIRROR - else - continue + OPENBSD_REPO="$MIRROR" fi done } - install_openbsd_deps() { __choose_openbsd_mirror || return 1 - [ -n "$OPENBSD_REPO" ] || return 1 echoinfo "setting package repository to $OPENBSD_REPO with ping time of $MINTIME" - echo "installpath = ${OPENBSD_REPO}${OS_VERSION}/packages/${CPU_ARCH_L}/" >/etc/pkg.conf || return 1 - pkg_add -I -v lsof || return 1 - pkg_add -I -v py-pip || return 1 - __linkfile /usr/local/bin/pip2.* /usr/local/bin/pip $BS_TRUE || return 1 - __linkfile /usr/local/bin/pydoc2* /usr/local/bin/pydoc $BS_TRUE || return 1 - __linkfile /usr/local/bin/python2.[0-9] /usr/local/bin/python $BS_TRUE || return 1 - __linkfile /usr/local/bin/python2.[0-9]*to3 /usr/local/bin/2to3 $BS_TRUE || return 1 - __linkfile /usr/local/bin/python2.[0-9]*-config /usr/local/bin/python-config $BS_TRUE || return 1 - pkg_add -I -v swig || return 1 - pkg_add -I -v py-zmq || return 1 - pkg_add -I -v py-requests || return 1 - pkg_add -I -v py-M2Crypto || return 1 - pkg_add -I -v py-raet || return 1 - pkg_add -I -v py-libnacl || return 1 - if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then - /usr/local/bin/pip install --upgrade pip || return 1 - fi - # - # PIP based installs need to copy configuration files "by hand". - # Let's trigger config_salt() - # - if [ "$_TEMP_CONFIG_DIR" = "null" ]; then - # Let's set the configuration directory to /tmp - _TEMP_CONFIG_DIR="/tmp" - CONFIG_SALT_FUNC="config_salt" + [ -n "$OPENBSD_REPO" ] || return 1 + echo "installpath += ${OPENBSD_REPO}" >>/etc/pkg.conf || return 1 - for fname in minion master syndic api; do - # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue - [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && \ - ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || __check_command_exists "salt-${fname}") && \ - continue - [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue - - # Let's download, since they were not provided, the default configuration files - if [ ! -f "$_SALT_ETC_DIR/$fname" ] && [ ! -f "$_TEMP_CONFIG_DIR/$fname" ]; then - ftp -o "$_TEMP_CONFIG_DIR/$fname" \ - "https://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1 - fi - done - fi if [ "${_EXTRA_PACKAGES}" != "" ]; then echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" # shellcheck disable=SC2086 @@ -4813,17 +4764,6 @@ install_openbsd_git_deps() { return 0 } -install_openbsd_stable() { - -# pkg_add -r -I -v salt || return 1 - __check_pip_allowed || return 1 - /usr/local/bin/pip install salt || return 1 - if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then - /usr/local/bin/pip install --upgrade salt || return 1 - fi - return 0 -} - install_openbsd_git() { # # Install from git @@ -4835,40 +4775,22 @@ install_openbsd_git() { return 0 } +install_openbsd_stable() { + pkg_add -r -I -v salt || return 1 + return 0 +} install_openbsd_post() { - # - # Install rc.d files. - # - ## below workaround for /etc/rc.d/rc.subr in OpenBSD >= 5.8 - ## is needed for salt services to start/stop properly from /etc/rc.d - ## reference: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/etc/rc.d/rc.subr.diff?r1=1.98&r2=1.99 - ## - if grep -q '\-xf' /etc/rc.d/rc.subr; then - cp -p /etc/rc.d/rc.subr /etc/rc.d/rc.subr - sed -i."$(date +%F)".saltinstall -e 's:-xf:-f:g' /etc/rc.d/rc.subr - fi - - _TEMP_CONFIG_DIR="/tmp" for fname in api master minion syndic; do - # Skip if not meant to be installed - [ $fname = "api" ] || ! __check_command_exists "salt-${fname}" && continue - [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue + [ $fname = "api" ] && continue [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue - [ $fname = "syndic" ] && continue + [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue + [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue - if [ $? -eq 1 ]; then - if [ ! -f "$_TEMP_CONFIG_DIR/salt-$fname" ]; then - ftp -o "$_TEMP_CONFIG_DIR/salt-$fname" \ - "https://raw.githubusercontent.com/saltstack/salt/develop/pkg/openbsd/salt-${fname}.rc-d" - if [ ! -f "/etc/rc.d/salt_${fname}" ] && [ "$(grep salt_${fname} /etc/rc.conf.local)" -eq "" ]; then - __copyfile "$_TEMP_CONFIG_DIR/salt-$fname" "/etc/rc.d/salt_${fname}" && chmod +x "/etc/rc.d/salt_${fname}" || return 1 - echo salt_${fname}_enable="YES" >> /etc/rc.conf.local - echo salt_${fname}_paths=\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin\" >>/etc/rc.conf.local - fi - fi - fi + rcctl enable salt_$fname done + + return 0 } install_openbsd_check_services() { @@ -4889,7 +4811,6 @@ install_openbsd_check_services() { return 0 } - install_openbsd_restart_daemons() { [ $_START_DAEMONS -eq $BS_FALSE ] && return @@ -4901,13 +4822,12 @@ install_openbsd_restart_daemons() { [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue - if [ -f "/etc/rc.d/salt_${fname}" ]; then - /etc/rc.d/salt_${fname} stop > /dev/null 2>&1 - /etc/rc.d/salt_${fname} start - fi - done -} + rcctl restart salt_${fname} + done + + return 0 +} # # Ended OpenBSD Install Functions @@ -4919,7 +4839,7 @@ install_openbsd_restart_daemons() { # SmartOS Install Functions # install_smartos_deps() { - pkgin -y install zeromq py27-m2crypto py27-crypto py27-msgpack py27-yaml py27-jinja2 py27-zmq py27-requests || return 1 + pkgin -y install zeromq py27-crypto py27-msgpack py27-yaml py27-jinja2 py27-zmq py27-requests || return 1 # Set _SALT_ETC_DIR to SmartOS default if they didn't specify _SALT_ETC_DIR=${BS_SALT_ETC_DIR:-/opt/local/etc/salt} @@ -4966,15 +4886,27 @@ install_smartos_git_deps() { fi if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then - # We're on the develop branch, install whichever tornado is on the requirements file + # Install whichever tornado is in the requirements file __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" __check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package '${__REQUIRED_TORNADO}'" + + # Install whichever futures is in the requirements file + __REQUIRED_FUTURES="$(grep futures "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" + __check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package '${__REQUIRED_FUTURES}'" + if [ "${__REQUIRED_TORNADO}" != "" ]; then if ! __check_command_exists pip; then pkgin -y install py27-pip fi pip install -U "${__REQUIRED_TORNADO}" fi + + if [ "${__REQUIRED_FUTURES}" != "" ]; then + if ! __check_command_exists pip; then + pkgin -y install py27-pip + fi + pip install -U "${__REQUIRED_FUTURES}" + fi fi __git_clone_and_checkout || return 1 @@ -5001,9 +4933,9 @@ install_smartos_git() { install_smartos_post() { smf_dir="/opt/custom/smf" - # Install manifest files if needed. - for fname in minion master syndic api; do + # Install manifest files if needed. + for fname in api master minion syndic; do # Skip if not meant to be installed [ $fname = "api" ] && \ ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue @@ -5029,17 +4961,20 @@ install_smartos_post() { fi fi done + + return 0 } install_smartos_git_post() { smf_dir="/opt/custom/smf" - # Install manifest files if needed. - for fname in minion master syndic api; do + # Install manifest files if needed. + for fname in api master minion syndic; do # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "api" ] && \ + ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue svcs "network/salt-$fname" > /dev/null 2>&1 @@ -5055,25 +4990,28 @@ install_smartos_git_post() { fi fi done + + return 0 } install_smartos_restart_daemons() { [ $_START_DAEMONS -eq $BS_FALSE ] && return - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue # Stop if running && Start service svcadm disable salt-$fname > /dev/null 2>&1 svcadm enable salt-$fname done + + return 0 } # # Ended SmartOS Install Functions @@ -5086,6 +5024,17 @@ install_smartos_restart_daemons() { # __ZYPPER_REQUIRES_REPLACE_FILES=-1 +__set_suse_pkg_repo() { + suse_pkg_url_path="${DISTRO_REPO}/systemsmanagement:saltstack.repo" + if [ "$_DOWNSTREAM_PKG_REPO" -eq $BS_TRUE ]; then + # FIXME: cleartext download over unsecure protocol (HTTP) + suse_pkg_url_base="http://download.opensuse.org/repositories/systemsmanagement:saltstack" + else + suse_pkg_url_base="${HTTP_VAL}://repo.saltstack.com/opensuse" + fi + SUSE_PKG_URL="$suse_pkg_url_base/$suse_pkg_url_path" +} + __version_lte() { if ! __check_command_exists python; then zypper zypper --non-interactive install --replacefiles --auto-agree-with-licenses python || \ @@ -5129,11 +5078,8 @@ install_opensuse_stable_deps() { if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then # Is the repository already known __set_suse_pkg_repo - __zypper repos --details | grep "${SUSE_PKG_URL}" >/dev/null 2>&1 - if [ $? -eq 1 ]; then - # zypper does not yet know anything about systemsmanagement_saltstack - __zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1 - fi + # Check zypper repos and refresh if necessary + __check_and_refresh_suse_pkg_repo fi __zypper --gpg-auto-import-keys refresh @@ -5245,14 +5191,13 @@ install_opensuse_git() { } install_opensuse_stable_post() { - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ]; then @@ -5264,21 +5209,23 @@ install_opensuse_stable_post() { /sbin/chkconfig --add salt-$fname /sbin/chkconfig salt-$fname on - done + + return 0 } install_opensuse_git_post() { - for fname in minion master syndic api; do - + for fname in api master minion syndic; do # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "api" ] && \ + ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ]; then use_usr_lib=$BS_FALSE + if [ "${DISTRO_MAJOR_VERSION}" -gt 13 ] || ([ "${DISTRO_MAJOR_VERSION}" -eq 13 ] && [ "${DISTRO_MINOR_VERSION}" -ge 2 ]); then use_usr_lib=$BS_TRUE fi @@ -5292,28 +5239,29 @@ install_opensuse_git_post() { else __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service" fi + continue fi __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname" "/etc/init.d/salt-$fname" chmod +x /etc/init.d/salt-$fname - done - install_opensuse_stable_post + install_opensuse_stable_post || return 1 + + return 0 } install_opensuse_restart_daemons() { [ $_START_DAEMONS -eq $BS_FALSE ] && return - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ]; then @@ -5333,17 +5281,18 @@ install_opensuse_check_services() { return 0 fi - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue + __check_services_systemd salt-$fname > /dev/null 2>&1 || __check_services_systemd salt-$fname.service > /dev/null 2>&1 || return 1 done + return 0 } # @@ -5372,11 +5321,8 @@ install_suse_12_stable_deps() { if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then # Is the repository already known __set_suse_pkg_repo - __zypper repos | grep "${SUSE_PKG_URL}" >/dev/null 2>&1 - if [ $? -eq 1 ]; then - # zypper does not yet know nothing about systemsmanagement_saltstack - __zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1 - fi + # Check zypper repos and refresh if necessary + __check_and_refresh_suse_pkg_repo fi __zypper --gpg-auto-import-keys refresh || return 1 @@ -5402,10 +5348,6 @@ install_suse_12_stable_deps() { __PACKAGES="${__PACKAGES} python-apache-libcloud" fi - # SLES 11 SP3 ships with both python-M2Crypto-0.22.* and python-m2crypto-0.21 and we will be asked which - # we want to install, even with --non-interactive. - # Let's try to install the higher version first and then the lower one in case of failure - __zypper_install 'python-M2Crypto>=0.22' || __zypper_install 'python-M2Crypto>=0.21' || return 1 # shellcheck disable=SC2086,SC2090 __zypper_install ${__PACKAGES} || return 1 @@ -5422,12 +5364,13 @@ install_suse_12_stable_deps() { _TEMP_CONFIG_DIR="/tmp" CONFIG_SALT_FUNC="config_salt" - for fname in minion master syndic api; do + for fname in api master minion syndic; do + # Skip salt-api since there is no example config for it in the Salt git repo + [ $fname = "api" ] && continue # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue # Syndic uses the same configuration file as the master @@ -5508,12 +5451,12 @@ install_suse_12_stable_post() { if [ "$SUSE_PATCHLEVEL" -gt 1 ]; then install_opensuse_stable_post || return 1 else - for fname in minion master syndic api; do - + for fname in api master minion syndic; do # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "api" ] && \ + ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ]; then @@ -5523,20 +5466,17 @@ install_suse_12_stable_post() { continue fi - ## shellcheck disable=SC2086 - #curl $_CURL_ARGS -L "https://github.com/saltstack/salt/raw/develop/pkg/rpm/salt-$fname" \ - # -o "/etc/init.d/salt-$fname" || return 1 - #chmod +x "/etc/init.d/salt-$fname" + # Skip salt-api since the service should be opt-in and not necessarily started on boot + [ $fname = "api" ] && continue if [ -f /bin/systemctl ]; then systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service) sleep 0.1 systemctl daemon-reload - continue fi - done fi + return 0 } @@ -5563,18 +5503,19 @@ install_suse_12_restart_daemons() { install_suse_11_stable_deps() { SUSE_PATCHLEVEL=$(awk '/PATCHLEVEL/ {print $3}' /etc/SuSE-release ) if [ "${SUSE_PATCHLEVEL}" != "" ]; then - DISTRO_PATCHLEVEL="_SP${SUSE_PATCHLEVEL}" + if [ "${SUSE_PATCHLEVEL}" != "4" ]; then + echowarn "Salt packages for SLE 11 are only build for SP4." + echowarn "Attempting to install SP4 packages on SP${SUSE_PATCHLEVEL}." + fi + DISTRO_PATCHLEVEL="_SP4" fi DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}${DISTRO_PATCHLEVEL}" if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then # Is the repository already known __set_suse_pkg_repo - __zypper repos | grep "${SUSE_PKG_URL}" >/dev/null 2>&1 - if [ $? -eq 1 ]; then - # zypper does not yet know nothing about systemsmanagement_saltstack - __zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1 - fi + # Check zypper repos and refresh if necessary + __check_and_refresh_suse_pkg_repo fi __zypper --gpg-auto-import-keys refresh || return 1 @@ -5596,10 +5537,6 @@ install_suse_11_stable_deps() { __PACKAGES="${__PACKAGES} python-PyYAML" fi - # SLES 11 SP3 ships with both python-M2Crypto-0.22.* and python-m2crypto-0.21 and we will be asked which - # we want to install, even with --non-interactive. - # Let's try to install the higher version first and then the lower one in case of failure - __zypper_install 'python-M2Crypto>=0.22' || __zypper_install 'python-M2Crypto>=0.21' || return 1 # shellcheck disable=SC2086,SC2090 __zypper_install ${__PACKAGES} || return 1 @@ -5616,12 +5553,13 @@ install_suse_11_stable_deps() { _TEMP_CONFIG_DIR="/tmp" CONFIG_SALT_FUNC="config_salt" - for fname in minion master syndic api; do + for fname in api master minion syndic; do + # Skip salt-api since there is no example config for it in the Salt git repo + [ $fname = "api" ] && continue # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue # Syndic uses the same configuration file as the master @@ -5701,12 +5639,12 @@ install_suse_11_stable_post() { if [ "$SUSE_PATCHLEVEL" -gt 1 ]; then install_opensuse_stable_post || return 1 else - for fname in minion master syndic api; do - + for fname in api master minion syndic; do # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "api" ] && \ + ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - [ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ]; then @@ -5753,17 +5691,18 @@ install_suse_check_services() { return 0 fi - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue + __check_services_systemd salt-$fname || return 1 done + return 0 } @@ -5789,7 +5728,7 @@ __gentoo_config_protection() { # this point, manually merge the changes using etc-update/dispatch-conf/ # cfg-update and then restart the bootstrapping script, so instead we allow # at this point to modify certain config files directly - export CONFIG_PROTECT_MASK="${CONFIG_PROTECT_MASK:-} /etc/portage/package.keywords /etc/portage/package.unmask /etc/portage/package.use /etc/portage/package.license" + export CONFIG_PROTECT_MASK="${CONFIG_PROTECT_MASK:-} /etc/portage/package.accept_keywords /etc/portage/package.keywords /etc/portage/package.license /etc/portage/package.unmask /etc/portage/package.use" } __gentoo_pre_dep() { @@ -5852,14 +5791,13 @@ install_gentoo_git() { } install_gentoo_post() { - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -d "/run/systemd/system" ]; then @@ -5875,14 +5813,13 @@ install_gentoo_post() { install_gentoo_restart_daemons() { [ $_START_DAEMONS -eq $BS_FALSE ] && return - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -d "/run/systemd/system" ]; then @@ -5901,17 +5838,18 @@ install_gentoo_check_services() { return 0 fi - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue # Skip if not meant to be installed [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue - #[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue + __check_services_systemd salt-$fname || return 1 done + return 0 } # @@ -6123,7 +6061,7 @@ daemons_running() { [ "$_START_DAEMONS" -eq $BS_FALSE ] && return 0 FAILED_DAEMONS=0 - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue @@ -6143,6 +6081,7 @@ daemons_running() { FAILED_DAEMONS=$((FAILED_DAEMONS + 1)) fi done + return $FAILED_DAEMONS } # @@ -6423,13 +6362,13 @@ if [ "$DAEMONS_RUNNING_FUNC" != "null" ] && [ ${_START_DAEMONS} -eq $BS_TRUE ]; if [ $? -ne 0 ]; then echoerror "Failed to run ${DAEMONS_RUNNING_FUNC}()!!!" - for fname in minion master syndic api; do + for fname in api master minion syndic; do # Skip salt-api since the service should be opt-in and not necessarily started on boot [ $fname = "api" ] && continue # Skip if not meant to be installed - [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ "$_ECHO_DEBUG" -eq $BS_FALSE ]; then diff --git a/tests/bootstrap/test_install.py b/tests/bootstrap/test_install.py index 0b34ec8..3195c2e 100644 --- a/tests/bootstrap/test_install.py +++ b/tests/bootstrap/test_install.py @@ -605,7 +605,7 @@ class InstallationTestCase(BootstrapTestCase): 0, self.run_script( script=None, - args=('git', 'clone', 'git://github.com/saltstack/salt.git'), + args=('git', 'clone', 'https://github.com/saltstack/salt.git'), cwd='/tmp/git', timeout=15 * 60, stream_stds=True