From 35cd8046a2cc79ffa38f1b5191c4421be3cf0e3f Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Sat, 23 Apr 2016 14:57:45 +0300 Subject: [PATCH 01/40] Fix bootstrapping from git on Debian 8 by installing latest `tornado` via pip --- bootstrap-salt.sh | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 83be1a13d..e16ad69a3 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2796,6 +2796,7 @@ install_debian_8_deps() { if [ $_START_DAEMONS -eq $BS_FALSE ]; then echowarn "Not starting daemons on Debian based distributions is not working mostly because starting them is the default behaviour." fi + # No user interaction, libc6 restart services for example export DEBIAN_FRONTEND=noninteractive @@ -2892,7 +2893,7 @@ install_debian_git_deps() { fi if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then - __check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" + __check_pip_allowed "You need to allow pip based installations (-P) in order to install requested 'apache-libcloud" pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi @@ -2962,15 +2963,23 @@ install_debian_8_git_deps() { fi __apt_get_install_noinput lsb-release python python-pkg-resources python-crypto \ - python-jinja2 python-m2crypto python-yaml msgpack-python python-pip || return 1 + python-jinja2 python-m2crypto python-yaml msgpack-python || return 1 __git_clone_and_checkout || return 1 if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then - # We're on the develop branch, install tornado __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" - if [ "${__REQUIRED_TORNADO}" != "" ]; then - __apt_get_install_noinput python-tornado + if [ -n "${__REQUIRED_TORNADO}" ]; then + __check_pip_allowed "You need to allow pip based installations (-P) in order to install required 'tornado' package" + + __PACKAGES="python-dev" + if ! __check_command_exists pip; then + __PACKAGES="${__PACKAGES} python-pip" + fi + + # shellcheck disable=SC2086 + __apt_get_install_noinput ${__PACKAGES} || return 1 + pip install -U tornado || return 1 fi fi @@ -3054,12 +3063,17 @@ install_debian_git_post() { # 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 = "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 - if [ ! -f /etc/systemd/system/salt-${fname}.service ] || ([ -f /etc/systemd/system/salt-${fname}.service ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then - __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" /etc/systemd/system + if [ ! -f /lib/systemd/system/salt-${fname}.service ] || \ + ([ -f /lib/systemd/system/salt-${fname}.service ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then + __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" /lib/systemd/system + # FIXME: add Debian-specific unit files to the salt main repo + sed -i -e '/^Type/ s/notify/simple/' /lib/systemd/system/salt-${fname}.service fi # Skip salt-api since the service should be opt-in and not necessarily started on boot From 0bcda90daca43ca2a03eccf0fd263a7210de97c3 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Mon, 25 Apr 2016 11:22:49 +0300 Subject: [PATCH 02/40] Close singe quote in the message. Thanks, @s0undt3ch --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index e16ad69a3..8fad023f5 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2893,7 +2893,7 @@ install_debian_git_deps() { fi if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then - __check_pip_allowed "You need to allow pip based installations (-P) in order to install requested 'apache-libcloud" + __check_pip_allowed "You need to allow pip based installations (-P) in order to install requested 'apache-libcloud' module" pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi @@ -2970,7 +2970,7 @@ install_debian_8_git_deps() { if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" if [ -n "${__REQUIRED_TORNADO}" ]; then - __check_pip_allowed "You need to allow pip based installations (-P) in order to install required 'tornado' package" + __check_pip_allowed "You need to allow pip based installations (-P) in order to install required 'tornado' module" __PACKAGES="python-dev" if ! __check_command_exists pip; then From ce3b96b14a7b0b2aba3db7bc1019eeda469706e5 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Wed, 27 Apr 2016 11:36:04 +0300 Subject: [PATCH 03/40] Use initscripts and units from Git working directory if present --- bootstrap-salt.sh | 48 +++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 8fad023f5..da3652c90 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2951,6 +2951,7 @@ install_debian_7_git_deps() { install_debian_8_git_deps() { install_debian_8_deps || return 1 + # No user interaction, libc6 restart services for example export DEBIAN_FRONTEND=noninteractive @@ -3061,43 +3062,54 @@ install_debian_git_post() { 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" ] && \ + [ "$fname" = "api" ] && \ ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && \ continue - [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -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 + # Configure SystemD for Debian 8 "Jessie" and later if [ -f /bin/systemctl ]; then if [ ! -f /lib/systemd/system/salt-${fname}.service ] || \ ([ -f /lib/systemd/system/salt-${fname}.service ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then - __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" /lib/systemd/system - # FIXME: add Debian-specific unit files to the salt main repo - sed -i -e '/^Type/ s/notify/simple/' /lib/systemd/system/salt-${fname}.service + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/pkg/deb/salt-${fname}.service" ]; then + __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/deb/salt-${fname}.service" /lib/systemd/system + __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/deb/salt-${fname}.environment" "/etc/default/salt-${fname}" + else + # workaround before adding Debian-specific unit files to the Salt main repo + __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" /lib/systemd/system + sed -i -e '/^Type/ s/notify/simple/' /lib/systemd/system/salt-${fname}.service + fi fi # Skip salt-api since the service should be opt-in and not necessarily started on boot - [ $fname = "api" ] && continue + [ "$fname" = "api" ] && continue - /bin/systemctl enable salt-${fname}.service + /bin/systemctl enable "salt-${fname}.service" SYSTEMD_RELOAD=$BS_TRUE - 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}/debian/salt-$fname.init" ]; then - __copyfile "${_SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init" "/etc/init.d/salt-$fname" + # 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 + 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 - __fetch_url "/etc/init.d/salt-$fname" "${HTTP_VAL}://anonscm.debian.org/cgit/pkg-salt/salt.git/plain/debian/salt-${fname}.init" + __fetch_url "/etc/init.d/salt-${fname}" "${HTTP_VAL}://anonscm.debian.org/cgit/pkg-salt/salt.git/plain/debian/salt-${fname}.init" fi - if [ ! -f "/etc/init.d/salt-$fname" ]; then - echowarn "The init script for salt-$fname was not found, skipping it..." + + if [ ! -f "/etc/init.d/salt-${fname}" ]; then + echowarn "The init script for salt-${fname} was not found, skipping it..." continue fi - chmod +x "/etc/init.d/salt-$fname" + + 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 + [ "$fname" = "api" ] && continue - update-rc.d "salt-$fname" defaults + update-rc.d "salt-${fname}" defaults fi done From 0474f4399d115d0cc69e9f2215ab4ca472799450 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Thu, 28 Apr 2016 10:49:39 +0300 Subject: [PATCH 04/40] Debian: check if the service is going to be started at any runlevel, fixes bootstrap in container (Docker, LXC) --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index da3652c90..dd7388487 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1889,8 +1889,8 @@ __check_services_debian() { servicename=$1 echodebug "Checking if service ${servicename} is enabled" - # shellcheck disable=SC2086,SC2046,SC2144 - if [ -f /etc/rc$(runlevel | awk '{ print $2 }').d/S*${servicename} ]; then + # Check if the service is going to be started at any runlevel, fixes bootstrap in container (Docker, LXC) + if ls /etc/rc?.d/S*"${servicename}" >/dev/null 2>&1; then echodebug "Service ${servicename} is enabled" return 0 else From 36a80e0ca1039383d518ab9700c37326ccefb38f Mon Sep 17 00:00:00 2001 From: Daniel Poelzleithner Date: Thu, 28 Apr 2016 20:19:20 +0200 Subject: [PATCH 05/40] Don't sleep 11 seconds if the user allowed overwrite of config files -C implies a overwrite and warns about this with a 11 second sleep. If the user explicitly allowed overwrite, there is no reason for this 11 second penelty. --- bootstrap-salt.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index ed3741f9e..03c94e9dc 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -5908,8 +5908,10 @@ config_salt() { if [ "$_CONFIG_ONLY" -eq "$BS_TRUE" ]; then echowarn "Passing -C (config only) option implies -F (forced overwrite)." - echowarn "Overwriting configs in 11 seconds!" - sleep 11 + if [ "$_FORCE_OVERWRITE" -ne "$BS_TRUE" ]; then + echowarn "Overwriting configs in 11 seconds!" + sleep 11 + fi fi if [ "$_INSTALL_MINION" -eq "$BS_TRUE" ] || [ "$_CONFIG_ONLY" -eq "$BS_TRUE" ]; then From 8291480da9367ab29fc1de7461e489b62bd27dbe Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Fri, 29 Apr 2016 17:03:48 +0300 Subject: [PATCH 06/40] Disable shell warning about unbound variable during git install --- bootstrap-salt.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index dd7388487..1c9bd1dc2 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -477,22 +477,26 @@ if [ "$ITYPE" = "git" ]; then GIT_REV="$1" shift fi + + # Disable shell warning about unbound variable during git install + STABLE_REV="" + # If doing stable install, check if version specified elif [ "$ITYPE" = "stable" ]; then if [ "$#" -eq 0 ];then STABLE_REV="latest" else __check_unparsed_options "$*" + if [ "$(echo "$1" | egrep '^(latest|1\.6|1\.7|2014\.1|2014\.7|2015\.5|2015\.8)$')" != "" ]; then - STABLE_REV="$1" - shift + STABLE_REV="$1" + shift elif [ "$(echo "$1" | egrep '^([0-9]*\.[0-9]*\.[0-9]*)$')" != "" ]; then - STABLE_REV="archive/$1" - shift + STABLE_REV="archive/$1" + shift else - echo "Unknown stable version: $1 (valid: 1.6, 1.7, 2014.1, 2014.7, 2015.5, 2015.8, latest, \$MAJOR.\$MINOR.\$PATCH)" - exit 1 - + echo "Unknown stable version: $1 (valid: 1.6, 1.7, 2014.1, 2014.7, 2015.5, 2015.8, latest, \$MAJOR.\$MINOR.\$PATCH)" + exit 1 fi fi fi From a9da2c6102ee17a2b66cf7e291f8f399ba1678ae Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Sat, 30 Apr 2016 16:34:34 +0300 Subject: [PATCH 07/40] Drop repetitive commands in `install_debian_8_git_deps()` function which alredy have been executed in `install_debian_8_deps` --- bootstrap-salt.sh | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 1c9bd1dc2..f3050c020 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2956,18 +2956,11 @@ install_debian_7_git_deps() { install_debian_8_git_deps() { install_debian_8_deps || return 1 - # No user interaction, libc6 restart services for example - export DEBIAN_FRONTEND=noninteractive - if ! __check_command_exists git; then __apt_get_install_noinput git || return 1 fi - if [ "$(dpkg-query -l 'python-zmq')" = "" ]; then - __apt_get_install_noinput libzmq3 libzmq3-dev python-zmq || return 1 - fi - - __apt_get_install_noinput lsb-release python python-pkg-resources python-crypto \ + __apt_get_install_noinput lsb-release python-pkg-resources python-crypto \ python-jinja2 python-m2crypto python-yaml msgpack-python || return 1 __git_clone_and_checkout || return 1 @@ -2994,16 +2987,6 @@ install_debian_8_git_deps() { CONFIG_SALT_FUNC="config_salt" 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 } From 70e1105404ab303ea4f0bb376958717a3deda9a3 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Sun, 1 May 2016 20:05:55 +0300 Subject: [PATCH 08/40] Debian 8: do git checkout before install majority of pkg dependencies --- bootstrap-salt.sh | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index f3050c020..928575296 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2960,27 +2960,32 @@ install_debian_8_git_deps() { __apt_get_install_noinput git || return 1 fi - __apt_get_install_noinput lsb-release python-pkg-resources python-crypto \ - python-jinja2 python-m2crypto python-yaml msgpack-python || return 1 - __git_clone_and_checkout || return 1 + __PACKAGES="lsb-release python-pkg-resources python-crypto python-jinja2 python-m2crypto python-yaml msgpack-python" + __PIP_PACKAGES="" + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then - __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" + __REQUIRED_TORNADO="$(grep ^tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" | tr -d ' ')" if [ -n "${__REQUIRED_TORNADO}" ]; then __check_pip_allowed "You need to allow pip based installations (-P) in order to install required 'tornado' module" - __PACKAGES="python-dev" + __PACKAGES="${__PACKAGES} python-dev" + __PIP_PACKAGES="${__PIP_PACKAGES} tornado" if ! __check_command_exists pip; then __PACKAGES="${__PACKAGES} python-pip" fi - - # shellcheck disable=SC2086 - __apt_get_install_noinput ${__PACKAGES} || return 1 - pip install -U tornado || return 1 fi fi + # shellcheck disable=SC2086 + __apt_get_install_noinput ${__PACKAGES} || return 1 + + if [ "${__PIP_PACKAGES}" != "" ]; then + # shellcheck disable=SC2086,SC2090 + pip install -U ${__PIP_PACKAGES} || return 1 + fi + # Let's trigger config_salt() if [ "$_TEMP_CONFIG_DIR" = "null" ]; then _TEMP_CONFIG_DIR="${_SALT_GIT_CHECKOUT_DIR}/conf/" From a51fec4a8a4ead9d92cd9a544de14d734474cd7f Mon Sep 17 00:00:00 2001 From: rallytime Date: Thu, 12 May 2016 10:57:15 -0600 Subject: [PATCH 09/40] Update .gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 644282475..a4b29eb47 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ /.project *.swp .vagrant + +# Pycharm +.idea + From 0339ca52d95e1205f376eea48b0ecbe4c76aa8cd Mon Sep 17 00:00:00 2001 From: rallytime Date: Fri, 6 May 2016 12:53:11 -0600 Subject: [PATCH 10/40] Add the ability to override master and/or minion configs from CLI --- bootstrap-salt.sh | 101 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 96 insertions(+), 5 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 1b71db313..1fc22159f 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -232,6 +232,8 @@ _NO_DEPS=$BS_FALSE _FORCE_SHALLOW_CLONE=$BS_FALSE _DISABLE_SSL=$BS_FALSE _DISABLE_REPOS=$BS_FALSE +_CUSTOM_MASTER_CONFIG="null" +_CUSTOM_MINION_CONFIG="null" #--- FUNCTION ------------------------------------------------------------------------------------------------------- @@ -334,12 +336,22 @@ __usage() { -r Disable all repository configuration performed by this script. This option assumes all necessary repository configuration is already present on the system. + -J Replace the Master config file with data passed in as a json string. If a + Master config file is found, a reasonable effort will be made to save the + file with a ".bak" extension. If used in conjunction with -C or -F, no ".bak" + file will be created as either of those options will force a complete + overwrite of the file. + -j Replace the Minion config file with data passed in as a json string. If a + Minion config file is found, a reasonable effort will be made to save the + file with a ".bak" extension. If used in conjunction with -C or -F, no ".bak" + file will be created as either of those options will force a complete + overwrite of the file. EOT } # ---------- end of function __usage ---------- -while getopts ":hvnDc:Gg:wk:s:MSNXCPFUKIA:i:Lp:dH:ZbflV:ar" opt +while getopts ":hvnDc:Gg:wk:s:MSNXCPFUKIA:i:Lp:dH:ZbflV:J:j:ar" opt do case "${opt}" in @@ -403,6 +415,8 @@ do V ) _VIRTUALENV_DIR="$OPTARG" ;; a ) _PIP_ALL=$BS_TRUE ;; r ) _DISABLE_REPOS=$BS_TRUE ;; + J ) _CUSTOM_MASTER_CONFIG=$OPTARG ;; + j ) _CUSTOM_MINION_CONFIG=$OPTARG ;; \?) echo echoerror "Option does not exist : $OPTARG" @@ -452,6 +466,21 @@ if [ "$_INSTALL_MINION" -eq $BS_FALSE ] && [ "$_SALT_MINION_ID" != "null" ]; the exit 1 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." + exit 1 + fi +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." + exit 1 + fi +fi # Define installation type if [ "$#" -eq 0 ];then @@ -1774,6 +1803,26 @@ __linkfile() { return 0 } +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: __overwriteconfig() +# DESCRIPTION: Simple function to overwrite master or minion config files. +#---------------------------------------------------------------------------------------------------------------------- +__overwriteconfig() { + if [ $# -eq 2 ]; then + target=$1 + json=$2 + else + echoerror "Wrong number of arguments for __convert_json_to_yaml_str()" + echoinfo "USAGE: __convert_json_to_yaml_str " + exit 1 + fi + + # Convert json string to a yaml string and write it to config file + 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();" || return 1 + + return 0 + +} #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: __rpm_import_gpg @@ -5882,6 +5931,13 @@ config_salt() { [ -d "$_SALT_ETC_DIR" ] || mkdir "$_SALT_ETC_DIR" || return 1 [ -d "$_PKI_DIR" ] || (mkdir -p "$_PKI_DIR" && chmod 700 "$_PKI_DIR") || return 1 + # If -C or -F was passed, we don't need a .bak file for the config we're updating + # This is used in the custom master/minion config file checks below + CREATE_BAK=$BS_TRUE + if [ "$_CONFIG_ONLY" -eq $BS_TRUE ] || [ "$_FORCE_OVERWRITE" -eq $BS_TRUE ]; then + CREATE_BAK=$BS_FALSE + fi + # Copy the grains file if found if [ -f "$_TEMP_CONFIG_DIR/grains" ]; then echodebug "Moving provided grains file from $_TEMP_CONFIG_DIR/grains to $_SALT_ETC_DIR/grains" @@ -5895,12 +5951,26 @@ config_salt() { sleep 11 fi - if [ "$_INSTALL_MINION" -eq "$BS_TRUE" ] || [ "$_CONFIG_ONLY" -eq "$BS_TRUE" ]; then + if [ "$_INSTALL_MINION" -eq "$BS_TRUE" ] || [ "$_CONFIG_ONLY" -eq "$BS_TRUE" ] || [ "$_CUSTOM_MINION_CONFIG" != "null" ]; then # Create the PKI directory [ -d "$_PKI_DIR/minion" ] || (mkdir -p "$_PKI_DIR/minion" && chmod 700 "$_PKI_DIR/minion") || return 1 + # Check to see if a custom minion config json dict was provided + if [ "$_CUSTOM_MINION_CONFIG" != "null" ]; then + + # Check if a minion config file already exists and move to .bak if needed + if [ -f "$_SALT_ETC_DIR/minion" ] && [ "$CREATE_BAK" -eq "$BS_TRUE" ]; then + __movefile "$_SALT_ETC_DIR/minion" "$_SALT_ETC_DIR/minion.bak" $BS_TRUE || return 1 + CONFIGURED_ANYTHING=$BS_TRUE + fi + + # Overwrite/create the config file with the yaml string + __overwriteconfig "$_SALT_ETC_DIR/minion" "$_CUSTOM_MINION_CONFIG" || return 1 + CONFIGURED_ANYTHING=$BS_TRUE + # Copy the minions configuration if found - if [ -f "$_TEMP_CONFIG_DIR/minion" ]; then + # Explicitly check for custom master config to avoid moving the minion config + elif [ -f "$_TEMP_CONFIG_DIR/minion" ] && [ "$_CUSTOM_MASTER_CONFIG" = "null" ]; then __movefile "$_TEMP_CONFIG_DIR/minion" "$_SALT_ETC_DIR" "$_CONFIG_ONLY" || return 1 CONFIGURED_ANYTHING=$BS_TRUE fi @@ -5934,12 +6004,25 @@ config_salt() { OVERWRITE_MASTER_CONFIGS=$BS_TRUE fi - if [ "$_INSTALL_MASTER" -eq $BS_TRUE ] || [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ] || [ "$OVERWRITE_MASTER_CONFIGS" -eq $BS_TRUE ]; then + if [ "$_INSTALL_MASTER" -eq $BS_TRUE ] || [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ] || [ "$OVERWRITE_MASTER_CONFIGS" -eq $BS_TRUE ] || [ "$_CUSTOM_MASTER_CONFIG" != "null" ]; then # Create the PKI directory [ -d "$_PKI_DIR/master" ] || (mkdir -p "$_PKI_DIR/master" && chmod 700 "$_PKI_DIR/master") || return 1 + # Check to see if a custom master config json dict was provided + if [ "$_CUSTOM_MASTER_CONFIG" != "null" ]; then + + # Check if a master config file already exists and move to .bak if needed + if [ -f "$_SALT_ETC_DIR/master" ] && [ "$CREATE_BAK" -eq "$BS_TRUE" ]; then + __movefile "$_SALT_ETC_DIR/master" "$_SALT_ETC_DIR/master.bak" $BS_TRUE || return 1 + CONFIGURED_ANYTHING=$BS_TRUE + fi + + # Overwrite/create the config file with the yaml string + __overwriteconfig "$_SALT_ETC_DIR/master" "$_CUSTOM_MASTER_CONFIG" || return 1 + CONFIGURED_ANYTHING=$BS_TRUE + # Copy the masters configuration if found - if [ -f "$_TEMP_CONFIG_DIR/master" ]; then + elif [ -f "$_TEMP_CONFIG_DIR/master" ]; then __movefile "$_TEMP_CONFIG_DIR/master" "$_SALT_ETC_DIR" || return 1 CONFIGURED_ANYTHING=$BS_TRUE fi @@ -6222,6 +6305,14 @@ if [ "$_CONFIG_ONLY" -eq $BS_FALSE ]; then fi +# Triggering config_salt() if overwriting master or minion configs +if [ "$_CUSTOM_MASTER_CONFIG" != "null" ] || [ "$_CUSTOM_MINION_CONFIG" != "null" ]; then + if [ "$_TEMP_CONFIG_DIR" = "null" ]; then + _TEMP_CONFIG_DIR="$_SALT_ETC_DIR" + fi + CONFIG_SALT_FUNC="config_salt" +fi + # Configure Salt if [ "$_TEMP_CONFIG_DIR" != "null" ] && [ "$CONFIG_SALT_FUNC" != "null" ]; then echoinfo "Running ${CONFIG_SALT_FUNC}()" From 268cea51e16eb3b11eb75e536399f3f3747f6a17 Mon Sep 17 00:00:00 2001 From: rallytime Date: Tue, 10 May 2016 12:59:27 -0600 Subject: [PATCH 11/40] Be more friendly with potential python errors when json may be invalid --- bootstrap-salt.sh | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 1fc22159f..c707ac92c 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1817,10 +1817,38 @@ __overwriteconfig() { exit 1 fi - # Convert json string to a yaml string and write it to config file - 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();" || return 1 + # Make a tempfile to dump any python errors into. + if __check_command_exists mktemp; then + tempfile="$(mktemp /tmp/salt-config-XXXXXXXX 2>/dev/null)" - return 0 + if [ -z "$tempfile" ]; then + echoerror "Failed to create temporary file in /tmp" + return 1 + fi + else + 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 + + # Check if there were any errors output to the tempfile + filesize=$(python -c "import os; print os.stat('$tempfile').st_size;") + + # No python errors output to the tempfile + if [ "$filesize" -eq 0 ]; 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()") + echodebug "$fullerror" + echoerror "Python error encountered. This is likely due to passing in a malformed JSON string. Please use -D to see stacktrace." + + rm -f "$tempfile" + + return 1 } From 29cad9c168131dab529c9b8a5dcb67dac3aad568 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Tue, 17 May 2016 15:53:34 +0300 Subject: [PATCH 12/40] Enable backports repo on Debian 8 if `pip` installation is not allowed --- bootstrap-salt.sh | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 928575296..15d033802 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2967,13 +2967,24 @@ install_debian_8_git_deps() { if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then __REQUIRED_TORNADO="$(grep ^tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" | tr -d ' ')" + if [ -n "${__REQUIRED_TORNADO}" ]; then - __check_pip_allowed "You need to allow pip based installations (-P) in order to install required 'tornado' module" + if (__check_pip_allowed >/dev/null 2>&1); then + __PACKAGES="${__PACKAGES} python-dev" + __PIP_PACKAGES="${__PIP_PACKAGES} tornado" - __PACKAGES="${__PACKAGES} python-dev" - __PIP_PACKAGES="${__PIP_PACKAGES} tornado" - if ! __check_command_exists pip; then - __PACKAGES="${__PACKAGES} python-pip" + if ! __check_command_exists pip; then + __PACKAGES="${__PACKAGES} python-pip" + fi + else + # Check if Debian Backports repo already configured + if ! apt-cache policy | grep -q 'Debian Backports'; then + echo 'deb http://httpredir.debian.org/debian jessie-backports main' > \ + /etc/apt/sources.list.d/backports.list + apt-get update + fi + + __PACKAGES="${__PACKAGES} python-tornado/jessie-backports" fi fi fi From 2db41fd824754116a9862b96fe8b5ff5d396584f Mon Sep 17 00:00:00 2001 From: Alexander Krasnukhin Date: Tue, 24 May 2016 13:58:29 +0200 Subject: [PATCH 13/40] Code style fix It somehow helps to not mix different flag styles in one command. --- bootstrap-salt.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.ps1 b/bootstrap-salt.ps1 index c7e019438..2b4eee25f 100644 --- a/bootstrap-salt.ps1 +++ b/bootstrap-salt.ps1 @@ -172,7 +172,7 @@ If($runservice) { } Else { Write-Output -NoNewline "Stopping salt minion and setting it to 'Manual'" - Set-Service "salt-minion" -startupType "Manual" + Set-Service "salt-minion" -StartupType "Manual" Stop-Service "salt-minion" } From 130e8ff170bd8cf32fd66d75d1a4df46de45e619 Mon Sep 17 00:00:00 2001 From: twangboy Date: Tue, 24 May 2016 13:37:44 -0600 Subject: [PATCH 14/40] Use installer defaults --- bootstrap-salt.ps1 | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/bootstrap-salt.ps1 b/bootstrap-salt.ps1 index 2b4eee25f..2fde10909 100644 --- a/bootstrap-salt.ps1 +++ b/bootstrap-salt.ps1 @@ -61,10 +61,10 @@ Param( [string]$runservice = "true", [Parameter(Mandatory=$false,ValueFromPipeline=$true)] - [string]$minion = "salt-minion", + [string]$minion = "not-specified", [Parameter(Mandatory=$false,ValueFromPipeline=$true)] - [string]$master = "master" + [string]$master = "not-specified" ) Write-Verbose "Parameters passed in:" @@ -88,10 +88,10 @@ Else { } # Create C:\tmp\ - if Vagrant doesn't upload keys and/or config it might not exist -New-Item C:\tmp\ -ItemType directory -force | out-null +New-Item C:\tmp\ -ItemType directory -Force | Out-Null # Copy minion keys & config to correct location -New-Item C:\salt\conf\pki\minion\ -ItemType directory -force | out-null +New-Item C:\salt\conf\pki\minion\ -ItemType Directory -Force | Out-Null # Check if minion keys have been uploaded If (Test-Path C:\tmp\minion.pem) { @@ -99,6 +99,13 @@ If (Test-Path C:\tmp\minion.pem) { cp C:\tmp\minion.pub C:\salt\conf\pki\minion\ } +# Check if minion config has been uploaded +# This should be done before the installer is run so that it can be updated with +# id: and master: settings when the installer runs +If (Test-Path C:\tmp\minion) { + Copy-Item -Path C:\tmp\minion -Destination C:\salt\conf -Force | Out-Null +} + # Detect architecture If ([IntPtr]::Size -eq 4) { $arch = "x86" @@ -111,7 +118,7 @@ if (!$version) { # Find latest version of Salt Minion $repo = Invoke-Restmethod 'http://repo.saltstack.com/windows/' $regex = "<\s*a\s*[^>]*?href\s*=\s*[`"']*([^`"'>]+)[^>]*?>" - $returnMatches = new-object System.Collections.ArrayList + $returnMatches = New-Object System.Collections.ArrayList $resultingMatches = [Regex]::Matches($repo, $regex, "IgnoreCase") foreach($match in $resultingMatches) { @@ -133,14 +140,20 @@ $webclient.DownloadFile($url, $file) # Install minion silently Write-Output -NoNewline "Installing Salt minion" -#Wait for process to exit before continuing. -C:\tmp\salt.exe /S /minion-name=$minion /master=$master | Out-Null +# Set the parameters for the installer +# Unless specified, use the installer defaults +# - id: +# - master: salt +# - Start the service +$parameters = "" +If($minion -neq "not-specified") {$parameters, "/minion-name=$minion" -join " "} +If($master -neq "not-specified") {$parameters, "/master=$master" -join " "} +If($runservice -eq $false) {$parameters, "/start-service=0" -join " "} + +#Wait for process to exit before continuing. +Start-Process C:\tmp\salt.exe -ArgumentList "/S $parameters" -Wait -NoNewWindow -PassThru | Out-Null -# Check if minion config has been uploaded -If (Test-Path C:\tmp\minion) { - cp C:\tmp\minion C:\salt\conf\ -} # Wait for salt-minion service to be registered before trying to start it $service = Get-Service salt-minion -ErrorAction SilentlyContinue From 71187597309f4a1c6a468349393fc63fad3879a6 Mon Sep 17 00:00:00 2001 From: twangboy Date: Tue, 24 May 2016 13:46:19 -0600 Subject: [PATCH 15/40] Add missing trailing back slash --- bootstrap-salt.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.ps1 b/bootstrap-salt.ps1 index 2fde10909..ea25dcf42 100644 --- a/bootstrap-salt.ps1 +++ b/bootstrap-salt.ps1 @@ -103,7 +103,7 @@ If (Test-Path C:\tmp\minion.pem) { # This should be done before the installer is run so that it can be updated with # id: and master: settings when the installer runs If (Test-Path C:\tmp\minion) { - Copy-Item -Path C:\tmp\minion -Destination C:\salt\conf -Force | Out-Null + Copy-Item -Path C:\tmp\minion -Destination C:\salt\conf\ -Force | Out-Null } # Detect architecture From 602b9c70ec3c0f881255f48ba402fd4ddca9d4ca Mon Sep 17 00:00:00 2001 From: twangboy Date: Wed, 25 May 2016 14:04:44 -0700 Subject: [PATCH 16/40] Fix regex and bad if statements --- bootstrap-salt.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bootstrap-salt.ps1 b/bootstrap-salt.ps1 index ea25dcf42..af8e65031 100644 --- a/bootstrap-salt.ps1 +++ b/bootstrap-salt.ps1 @@ -53,7 +53,7 @@ SaltStack Download Location - https://repo.saltstack.com/windows/ Param( [Parameter(Mandatory=$false,ValueFromPipeline=$true)] # Doesn't support versions prior to "YYYY.M.R-B" - [ValidatePattern('^(201[0-9]\.[0-9]\.[0-9](\-\d{1})?)$')] + [ValidatePattern('^201\d\.\d{1,2}\.\d{1,2}(\-\d{1})?|(rc\d)$')] [string]$version = '', [Parameter(Mandatory=$false,ValueFromPipeline=$true)] @@ -127,7 +127,7 @@ if (!$version) { } if ($arch -eq 'x86') {$returnMatches = $returnMatches | Where {$_ -like "Salt-Minion*x86-Setup.exe"}} else {$returnMatches = $returnMatches | Where {$_ -like "Salt-Minion*AMD64-Setup.exe"}} - + $version = $(($returnMatches | Sort-Object -Descending)[0]).Split(("n-","-A","-x"),([System.StringSplitOptions]::RemoveEmptyEntries))[1] } @@ -147,8 +147,8 @@ Write-Output -NoNewline "Installing Salt minion" # - master: salt # - Start the service $parameters = "" -If($minion -neq "not-specified") {$parameters, "/minion-name=$minion" -join " "} -If($master -neq "not-specified") {$parameters, "/master=$master" -join " "} +If($minion -ne "not-specified") {$parameters, "/minion-name=$minion" -join " "} +If($master -ne "not-specified") {$parameters, "/master=$master" -join " "} If($runservice -eq $false) {$parameters, "/start-service=0" -join " "} #Wait for process to exit before continuing. From 49f0a16b65c4711c33fea309f88a2d2a1f9e76e5 Mon Sep 17 00:00:00 2001 From: twangboy Date: Wed, 25 May 2016 16:02:03 -0700 Subject: [PATCH 17/40] Fix parameters, escalate privelages --- bootstrap-salt.ps1 | 71 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 62 insertions(+), 9 deletions(-) diff --git a/bootstrap-salt.ps1 b/bootstrap-salt.ps1 index af8e65031..b97032f15 100644 --- a/bootstrap-salt.ps1 +++ b/bootstrap-salt.ps1 @@ -23,7 +23,7 @@ Useful for testing locally from the command line with the --local switch .EXAMPLE ./bootstrap-salt.ps1 -minion minion-box -master master-box Specifies the minion and master ids in the minion config. -Defaults to the installer values of "minion" and "master". +Defaults to the installer values of host name for the minion id and "salt" for the master. .EXAMPLE ./bootstrap-salt.ps1 -minion minion-box -master master-box -version 2015.5.2 -runservice false @@ -32,12 +32,12 @@ Specifies all the optional parameters in no particular order. .PARAMETER version - Default version defined in this script. .PARAMETER runservice - Boolean flag to stop the windows service and set to "manual". - Installer starts it by default. + Installer starts it by default. .PARAMETER minion - Name of the minion being installed on this host. - Installer defaults to "minion". + Installer defaults to the host name. -.PARAMETER master - Name or IP of the master server the minion. Installer defaults to "master". +.PARAMETER master - Name or IP of the master server the minion. Installer defaults to "salt". .NOTES All of the parameters are optional. The default should be the latest version. The architecture @@ -49,6 +49,10 @@ Original Vagrant Provisioner Project -https://github.com/saltstack/salty-vagrant Vagrant Project (utilizes this script) - https://github.com/mitchellh/vagrant SaltStack Download Location - https://repo.saltstack.com/windows/ #> + +#============================================================================== +# Commandlet Binding +#============================================================================== [CmdletBinding()] Param( [Parameter(Mandatory=$false,ValueFromPipeline=$true)] @@ -67,6 +71,55 @@ Param( [string]$master = "not-specified" ) +#============================================================================== +# Script Functions +#============================================================================== +function Get-IsAdministrator +{ + $Identity = [System.Security.Principal.WindowsIdentity]::GetCurrent() + $Principal = New-Object System.Security.Principal.WindowsPrincipal($Identity) + $Principal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator) +} + +function Get-IsUacEnabled +{ + (Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System).EnableLua -ne 0 +} + +#============================================================================== +# Check for Elevated Privileges +#============================================================================== +If (!(Get-IsAdministrator)) { + If (Get-IsUacEnabled) { + # We are not running "as Administrator" - so relaunch as administrator + # Create a new process object that starts PowerShell + $newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell"; + + # Specify the current script path and name as a parameter` + $parameters = "" + If($minion -ne "not-specified") {$parameters = "-minion $minion"} + If($master -ne "not-specified") {$parameters = "$parameters -master $master"} + If($runservice -eq $false) {$parameters = "$parameters -runservice false"} + If($version -ne '') {$parameters = "$parameters -version $version"} + $newProcess.Arguments = $myInvocation.MyCommand.Definition, $parameters + + # Specify the current working directory + $newProcess.WorkingDirectory = "$script_path" + + # Indicate that the process should be elevated + $newProcess.Verb = "runas"; + + # Start the new process + [System.Diagnostics.Process]::Start($newProcess); + + # Exit from the current, unelevated, process + Exit + + } Else { + Throw "You must be administrator to run this script" + } +} + Write-Verbose "Parameters passed in:" Write-Verbose "version: $version" Write-Verbose "runservice: $runservice" @@ -132,14 +185,14 @@ if (!$version) { } # Download minion setup file -Write-Output -NoNewline "Downloading Salt minion installer Salt-Minion-$version-$arch-Setup.exe" +Write-Output "Downloading Salt minion installer Salt-Minion-$version-$arch-Setup.exe" $webclient = New-Object System.Net.WebClient $url = "https://repo.saltstack.com/windows/Salt-Minion-$version-$arch-Setup.exe" $file = "C:\tmp\salt.exe" $webclient.DownloadFile($url, $file) # Install minion silently -Write-Output -NoNewline "Installing Salt minion" +Write-Output "Installing Salt minion" # Set the parameters for the installer # Unless specified, use the installer defaults @@ -147,9 +200,9 @@ Write-Output -NoNewline "Installing Salt minion" # - master: salt # - Start the service $parameters = "" -If($minion -ne "not-specified") {$parameters, "/minion-name=$minion" -join " "} -If($master -ne "not-specified") {$parameters, "/master=$master" -join " "} -If($runservice -eq $false) {$parameters, "/start-service=0" -join " "} +If($minion -ne "not-specified") {$parameters = "/minion-name=$minion"} +If($master -ne "not-specified") {$parameters = "$parameters /master=$master"} +If($runservice -eq $false) {$parameters = "$parameters /start-service=0"} #Wait for process to exit before continuing. Start-Process C:\tmp\salt.exe -ArgumentList "/S $parameters" -Wait -NoNewWindow -PassThru | Out-Null From 777da7eff7e971cb372aa3b9cedbed0946367e21 Mon Sep 17 00:00:00 2001 From: Marc Vieira-Cardinal Date: Wed, 25 May 2016 22:38:40 -0400 Subject: [PATCH 18/40] Removed ubuntu version restriction for apt-get update LXC containers provisioned through Saltstack fail the bootstrap step because of outdated apt-get references. We should not assume that the state of the cache is up to date. --- bootstrap-salt.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 0c7fcd6ab..592b30f9e 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2398,9 +2398,7 @@ install_ubuntu_daily_deps() { } install_ubuntu_git_deps() { - if [ "$DISTRO_MAJOR_VERSION" -eq 12 ]; then - apt-get update - fi + apt-get update __apt_get_install_noinput git-core || return 1 __git_clone_and_checkout || return 1 From cdc3ce070eff7fbbb3533272d861a8bcc8baba85 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Thu, 26 May 2016 11:24:46 +0300 Subject: [PATCH 19/40] Drop support for Debian 6 old-old-stable "squeeze": reached end-of-life --- README.rst | 2 +- bootstrap-salt.sh | 169 +--------------------------------------------- 2 files changed, 2 insertions(+), 169 deletions(-) diff --git a/README.rst b/README.rst index d38040f53..05978a5fb 100644 --- a/README.rst +++ b/README.rst @@ -206,7 +206,7 @@ Supported Operating Systems Debian and derivatives ~~~~~~~~~~~~~~~~~~~~~~ -- Debian GNU/Linux 6/7/8 +- Debian GNU/Linux 7/8 - Linux Mint Debian Edition 1 (based on Debian 8) - Kali Linux 1.0 (based on Debian 7) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 0c7fcd6ab..57e17c35f 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -223,7 +223,6 @@ _SALT_MINION_ID="null" # _SIMPLIFY_VERSION is mostly used in Solaris based distributions _SIMPLIFY_VERSION=$BS_TRUE _LIBCLOUD_MIN_VERSION="0.14.0" -_PY_REQUESTS_MIN_VERSION="2.0" _EXTRA_PACKAGES="" _HTTP_PROXY="" _DISABLE_SALT_CHECKS=$BS_FALSE @@ -1549,7 +1548,7 @@ __check_end_of_life_versions() { case "${DISTRO_NAME_L}" in debian) # Debian versions bellow 6 are not supported - if [ "$DISTRO_MAJOR_VERSION" -lt 6 ]; then + if [ "$DISTRO_MAJOR_VERSION" -lt 7 ]; then echoerror "End of life distributions are not supported." echoerror "Please consider upgrading to the next stable. See:" echoerror " https://wiki.debian.org/DebianReleases" @@ -2658,15 +2657,6 @@ install_debian_deps() { __PACKAGES="procps pciutils" __PIP_PACKAGES="" - if [ "$DISTRO_MAJOR_VERSION" -lt 6 ]; then - # Both python-requests which is a hard dependency and apache-libcloud which is a soft dependency, under debian < 6 - # need to be installed using pip - __check_pip_allowed "You need to allow pip based installations (-P) in order to install the python 'requests' package" - __PACKAGES="${__PACKAGES} python-pip" - # shellcheck disable=SC2089 - __PIP_PACKAGES="${__PIP_PACKAGES} 'requests>=$_PY_REQUESTS_MIN_VERSION'" - fi - # shellcheck disable=SC2086 __apt_get_install_noinput ${__PACKAGES} || return 1 @@ -2693,120 +2683,6 @@ install_debian_deps() { return 0 } -install_debian_6_deps() { - if [ $_START_DAEMONS -eq $BS_FALSE ]; then - echowarn "Not starting daemons on Debian based distributions is not working mostly because starting them is the default behaviour." - fi - # No user interaction, libc6 restart services for example - export DEBIAN_FRONTEND=noninteractive - - apt-get update - - # Make sure wget is available - __apt_get_install_noinput wget - - # Install Keys - __apt_get_install_noinput debian-archive-keyring && apt-get update - - # Install Debian Archive Automatic Signing Key (6.0/squeeze), see #557 - if [ "$(apt-key finger | grep '9FED 2BCB DCD2 9CDF 7626 78CB AED4 B06F 4730 41FA')" = "" ]; then - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys AED4B06F473041FA || return 1 - fi - - # shellcheck disable=SC2086 - __fetch_verify http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key 267d1f152d0cc94b23eb4c6993ba3d67 3100 | apt-key add - || return 1 - - if [ "$_PIP_ALLOWED" -eq $BS_TRUE ]; then - echowarn "PyZMQ will be installed from PyPI in order to compile it against ZMQ3" - echowarn "This is required for long term stable minion connections to the master." - echowarn "YOU WILL END UP WITH QUITE A FEW PACKAGES FROM DEBIAN UNSTABLE" - echowarn "Sleeping for 5 seconds so you can cancel..." - sleep 5 - - if [ ! -f /etc/apt/sources.list.d/debian-unstable.list ]; then - cat <<_eof > /etc/apt/sources.list.d/debian-unstable.list -deb http://ftp.debian.org/debian unstable main -deb-src http://ftp.debian.org/debian unstable main -_eof - - cat <<_eof > /etc/apt/preferences.d/libzmq3-debian-unstable.pref -Package: libzmq3 -Pin: release a=unstable -Pin-Priority: 800 - -Package: libzmq3-dev -Pin: release a=unstable -Pin-Priority: 800 -_eof - fi - - apt-get update - # We NEED to install the unstable dpkg or mime-support WILL fail to install - __apt_get_install_noinput -t unstable dpkg liblzma5 python mime-support || return 1 - __apt_get_install_noinput -t unstable libzmq3 libzmq3-dev || return 1 - __apt_get_install_noinput build-essential python-dev python-pip python-setuptools || return 1 - - if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then - # Saltstack's Unstable Debian repository - if [ "$(grep -R 'debian.saltstack.com' /etc/apt)" = "" ]; then - echo "deb http://debian.saltstack.com/debian unstable main" >> \ - /etc/apt/sources.list.d/saltstack.list - fi - fi - return 0 - fi - - if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then - # Debian Backports - if [ "$(grep -R 'squeeze-backports' /etc/apt | grep -v "^#")" = "" ]; then - echo "deb http://ftp.de.debian.org/debian-backports squeeze-backports main" >> \ - /etc/apt/sources.list.d/backports.list - fi - - # Saltstack's Stable Debian repository - if [ "$(grep -R 'squeeze-saltstack' /etc/apt)" = "" ]; then - echo "deb http://debian.saltstack.com/debian squeeze-saltstack main" >> \ - /etc/apt/sources.list.d/saltstack.list - fi - apt-get update || return 1 - fi - - # Python requests is available through Squeeze backports - # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 - __apt_get_install_noinput python-pip procps pciutils python-requests - - # Need python-apt for managing packages via Salt - __apt_get_install_noinput python-apt - - if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then - __check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud/requests" - pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" - - fi - - if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then - __apt_get_upgrade_noinput || return 1 - fi - - __apt_get_install_noinput python-zmq || return 1 - - if [ "$_PIP_ALLOWED" -eq $BS_TRUE ]; then - # Building pyzmq from source to build it against libzmq3. - # Should override current installation - # Using easy_install instead of pip because at least on Debian 6, - # there's no default virtualenv active. - easy_install -U pyzmq || 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 -} - install_debian_7_deps() { if [ $_START_DAEMONS -eq $BS_FALSE ]; then echowarn "Not starting daemons on Debian based distributions is not working mostly because starting them is the default behaviour." @@ -3004,39 +2880,6 @@ install_debian_git_deps() { return 0 } -install_debian_6_git_deps() { - install_debian_6_deps || return 1 - if [ "$_PIP_ALLOWED" -eq $BS_TRUE ]; then - __PACKAGES="build-essential lsb-release python python-dev python-pkg-resources python-crypto" - __PACKAGES="${__PACKAGES} python-m2crypto python-yaml msgpack-python python-pip python-setuptools" - - if ! __check_command_exists git; then - __PACKAGES="${__PACKAGES} git" - fi - - # shellcheck disable=SC2086 - __apt_get_install_noinput ${__PACKAGES} || return 1 - - easy_install -U pyzmq Jinja2 || return 1 - - __git_clone_and_checkout || return 1 - - # Let's trigger config_salt() - if [ "$_TEMP_CONFIG_DIR" = "null" ]; then - _TEMP_CONFIG_DIR="${_SALT_GIT_CHECKOUT_DIR}/conf/" - CONFIG_SALT_FUNC="config_salt" - fi - else - install_debian_git_deps || return 1 # Grab the actual deps - fi - - if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then - __apt_get_upgrade_noinput || return 1 - fi - - return 0 -} - install_debian_7_git_deps() { install_debian_7_deps || return 1 install_debian_git_deps || return 1 # Grab the actual deps @@ -3113,11 +2956,6 @@ install_debian_stable() { return 0 } -install_debian_6_stable() { - install_debian_stable || return 1 - return 0 -} - install_debian_7_stable() { install_debian_stable || return 1 return 0 @@ -3136,11 +2974,6 @@ install_debian_git() { fi } -install_debian_6_git() { - install_debian_git || return 1 - return 0 -} - install_debian_7_git() { install_debian_git || return 1 return 0 From 4eaccf2371eb545a98e286a6d322ac69daabf382 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Fri, 27 May 2016 12:03:46 +0300 Subject: [PATCH 20/40] Install Salt packages from repo.saltstack.com on Debian 7 "Wheezy" --- bootstrap-salt.sh | 64 ++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 57e17c35f..7f7841859 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2684,9 +2684,19 @@ install_debian_deps() { } install_debian_7_deps() { + if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then + if [ "$CPU_ARCH_L" = "amd64" ] || [ "$CPU_ARCH_L" = "x86_64" ]; then + repo_arch="amd64" + elif [ "$CPU_ARCH_L" = "i386" ] || [ "$CPU_ARCH_L" = "i686" ]; then + echoerror "repo.saltstack.com likely doesn't have 32-bit packages for Debian (yet?)" + repo_arch="i386" + fi + fi + if [ $_START_DAEMONS -eq $BS_FALSE ]; then echowarn "Not starting daemons on Debian based distributions is not working mostly because starting them is the default behaviour." fi + # No user interaction, libc6 restart services for example export DEBIAN_FRONTEND=noninteractive @@ -2704,40 +2714,34 @@ install_debian_7_deps() { fi if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then - # Debian Backports - if [ "$(grep -R 'wheezy-backports' /etc/apt | grep -v "^#")" = "" ]; then - echo "deb http://httpredir.debian.org/debian wheezy-backports main" >> \ - /etc/apt/sources.list.d/backports.list - fi + # Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com + if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" != "" ]; then + SALTSTACK_DEBIAN_URL="${HTTP_VAL}://repo.saltstack.com/apt/debian/$DISTRO_MAJOR_VERSION/$repo_arch/$STABLE_REV" + 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 + fi - # Saltstack's Stable Debian repository - if [ "$(grep -R 'wheezy-saltstack' /etc/apt)" = "" ]; then - echo "deb http://debian.saltstack.com/debian wheezy-saltstack main" >> \ - /etc/apt/sources.list.d/saltstack.list + # shellcheck disable=SC2086 + wget $_WGET_ARGS -q "$SALTSTACK_DEBIAN_URL/SALTSTACK-GPG-KEY.pub" -O - | apt-key add - || return 1 fi fi - # shellcheck disable=SC2086 - __fetch_verify http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key 267d1f152d0cc94b23eb4c6993ba3d67 3100 | apt-key add - || return 1 - apt-get update || return 1 - __apt_get_install_noinput -t wheezy-backports libzmq3 libzmq3-dev python-zmq python-apt || return 1 - # Install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 - __PACKAGES="procps pciutils" - # Also install python-requests - __PACKAGES="${__PACKAGES} python-requests" - # shellcheck disable=SC2086 - __apt_get_install_noinput ${__PACKAGES} || return 1 + __PACKAGES="libzmq3 libzmq3-dev python-zmq python-requests python-apt" + # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 + __PACKAGES="${__PACKAGES} procps pciutils" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then - __PACKAGES="build-essential python-dev python-pip" - # shellcheck disable=SC2086 - __apt_get_install_noinput ${__PACKAGES} || return 1 - __check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" - pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" || return 1 + # Install python-libcloud if asked to + __PACKAGES="${__PACKAGES} python-libcloud" fi + # shellcheck disable=SC2086 + __apt_get_install_noinput ${__PACKAGES} || return 1 + if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then __apt_get_upgrade_noinput || return 1 fi @@ -2752,8 +2756,6 @@ install_debian_7_deps() { } install_debian_8_deps() { - echodebug "install_debian_8_deps" - if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then if [ "$CPU_ARCH_L" = "amd64" ] || [ "$CPU_ARCH_L" = "x86_64" ]; then repo_arch="amd64" @@ -2789,18 +2791,18 @@ install_debian_8_deps() { SALTSTACK_DEBIAN_URL="${HTTP_VAL}://repo.saltstack.com/apt/debian/$DISTRO_MAJOR_VERSION/$repo_arch/$STABLE_REV" echo "deb $SALTSTACK_DEBIAN_URL jessie main" > "/etc/apt/sources.list.d/saltstack.list" - # shellcheck disable=SC2086 - wget $_WGET_ARGS -q "$SALTSTACK_DEBIAN_URL/SALTSTACK-GPG-KEY.pub" -O - | apt-key add - || return 1 - if [ "${HTTP_VAL}" = "https" ] ; then - __apt_get_install_noinput apt-transport-https || return 1 + __apt_get_install_noinput ca-certificates apt-transport-https || return 1 fi + + # shellcheck disable=SC2086 + wget $_WGET_ARGS -q "$SALTSTACK_DEBIAN_URL/SALTSTACK-GPG-KEY.pub" -O - | apt-key add - || return 1 fi fi apt-get update || return 1 - __PACKAGES="libzmq3 libzmq3-dev python-zmq python-requests python-apt" + __PACKAGES="libzmq3 libzmq3-dev python-zmq python-requests python-apt" # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 __PACKAGES="${__PACKAGES} procps pciutils" From e040eb46717fa14de42e9a569410e5bd4e3d3c28 Mon Sep 17 00:00:00 2001 From: Peter Tripp Date: Mon, 16 May 2016 09:48:08 -0700 Subject: [PATCH 21/40] Ubuntu 16.04 Xenial Support. Fix systemd systemctl path. --- bootstrap-salt.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 57e17c35f..7842f7c23 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -516,14 +516,14 @@ elif [ "$ITYPE" = "stable" ]; then else __check_unparsed_options "$*" - if [ "$(echo "$1" | egrep '^(latest|1\.6|1\.7|2014\.1|2014\.7|2015\.5|2015\.8)$')" != "" ]; then + if [ "$(echo "$1" | egrep '^(latest|1\.6|1\.7|2014\.1|2014\.7|2015\.5|2015\.8|2016\.3)$')" != "" ]; then STABLE_REV="$1" shift elif [ "$(echo "$1" | egrep '^([0-9]*\.[0-9]*\.[0-9]*)$')" != "" ]; then STABLE_REV="archive/$1" shift else - echo "Unknown stable version: $1 (valid: 1.6, 1.7, 2014.1, 2014.7, 2015.5, 2015.8, latest, \$MAJOR.\$MINOR.\$PATCH)" + echo "Unknown stable version: $1 (valid: 1.6, 1.7, 2014.1, 2014.7, 2015.5, 2015.8, 2016.3, latest, \$MAJOR.\$MINOR.\$PATCH)" exit 1 fi fi @@ -1217,6 +1217,9 @@ __ubuntu_codename_translation() { DISTRO_CODENAME="wily" fi ;; + "16") + DISTRO_CODENAME="xenial" + ;; *) DISTRO_CODENAME="trusty" ;; @@ -2318,7 +2321,7 @@ install_ubuntu_stable_deps() { if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then # Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com - if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" != "" ]; then + if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|2016\.3|latest|archive\/)')" != "" ]; then # Workaround for latest non-LTS ubuntu if [ "$DISTRO_MAJOR_VERSION" -eq 15 ]; then echowarn "Non-LTS Ubuntu detected, but stable packages requested. Trying packages from latest LTS release. You may experience problems" @@ -2481,7 +2484,7 @@ install_ubuntu_git() { install_ubuntu_stable_post() { # Workaround for latest LTS packages on latest ubuntu. Normally packages on # debian-based systems will automatically start the corresponding daemons - if [ "$DISTRO_MAJOR_VERSION" -ne 15 ]; then + if [ "$DISTRO_MAJOR_VERSION" -lt 15 ]; then return 0 fi @@ -2502,7 +2505,7 @@ install_ubuntu_stable_post() { /bin/systemctl enable salt-$fname.service > /dev/null 2>&1 ) sleep 0.1 - /usr/bin/systemctl daemon-reload + /bin/systemctl daemon-reload elif [ -f /etc/init.d/salt-$fname ]; then update-rc.d salt-$fname defaults fi From 83f25eb684802cdb3a10b1c60c0aeb0497dae942 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Sat, 28 May 2016 21:40:35 +0300 Subject: [PATCH 22/40] Debian: check available stable version to install more precisely --- bootstrap-salt.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 7f7841859..11dd66673 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2714,8 +2714,8 @@ install_debian_7_deps() { fi if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then - # Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com - if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" != "" ]; then + # Versions starting with 2015.8.7 are hosted at repo.saltstack.com + if [ "$(echo "$STABLE_REV" | egrep '^(2015\.8|2016\.3|latest|archive\/201[5-6]\.)')" != "" ]; then SALTSTACK_DEBIAN_URL="${HTTP_VAL}://repo.saltstack.com/apt/debian/$DISTRO_MAJOR_VERSION/$repo_arch/$STABLE_REV" echo "deb $SALTSTACK_DEBIAN_URL wheezy main" > "/etc/apt/sources.list.d/saltstack.list" @@ -2725,6 +2725,9 @@ install_debian_7_deps() { # shellcheck disable=SC2086 wget $_WGET_ARGS -q "$SALTSTACK_DEBIAN_URL/SALTSTACK-GPG-KEY.pub" -O - | apt-key add - || return 1 + elif [ -n "$STABLE_REV" ]; then + echoerror "Installation of Salt $STABLE_REV currently unsupported by ${__ScriptName} ${__ScriptVersion}" + return 1 fi fi @@ -2786,8 +2789,8 @@ install_debian_8_deps() { fi if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then - # Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com - if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" != "" ]; then + # Versions starting with 2015.5.6, 2015.8.1 and 2016.3.0 are hosted at repo.saltstack.com + if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|2016\.3|latest|archive\/201[5-6]\.)')" != "" ]; then SALTSTACK_DEBIAN_URL="${HTTP_VAL}://repo.saltstack.com/apt/debian/$DISTRO_MAJOR_VERSION/$repo_arch/$STABLE_REV" echo "deb $SALTSTACK_DEBIAN_URL jessie main" > "/etc/apt/sources.list.d/saltstack.list" @@ -2797,6 +2800,9 @@ install_debian_8_deps() { # shellcheck disable=SC2086 wget $_WGET_ARGS -q "$SALTSTACK_DEBIAN_URL/SALTSTACK-GPG-KEY.pub" -O - | apt-key add - || return 1 + elif [ -n "$STABLE_REV" ]; then + echoerror "Installation of Salt $STABLE_REV currently unsupported by ${__ScriptName} ${__ScriptVersion}" + return 1 fi fi From 38ef8f4e3e9518eba04f8610273535a121509042 Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Mon, 30 May 2016 14:17:51 +0300 Subject: [PATCH 23/40] Fix git installation on Debian 7 by enabling SaltStack corp repo to satisfy dependencies --- bootstrap-salt.sh | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 11dd66673..afd135ee2 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2715,8 +2715,9 @@ install_debian_7_deps() { if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then # Versions starting with 2015.8.7 are hosted at repo.saltstack.com - if [ "$(echo "$STABLE_REV" | egrep '^(2015\.8|2016\.3|latest|archive\/201[5-6]\.)')" != "" ]; then - SALTSTACK_DEBIAN_URL="${HTTP_VAL}://repo.saltstack.com/apt/debian/$DISTRO_MAJOR_VERSION/$repo_arch/$STABLE_REV" + if [ "$(echo "$STABLE_REV" | egrep '^(2015\.8|2016\.3|latest|archive\/201[5-6]\.)')" != "" ] || \ + [ "$ITYPE" = "git" ]; then + SALTSTACK_DEBIAN_URL="${HTTP_VAL}://repo.saltstack.com/apt/debian/$DISTRO_MAJOR_VERSION/$repo_arch/${STABLE_REV:-latest}" echo "deb $SALTSTACK_DEBIAN_URL wheezy main" > "/etc/apt/sources.list.d/saltstack.list" if [ "${HTTP_VAL}" = "https" ] ; then @@ -2834,17 +2835,6 @@ install_debian_8_deps() { } install_debian_git_deps() { - if [ $_START_DAEMONS -eq $BS_FALSE ]; then - echowarn "Not starting daemons on Debian based distributions is not working mostly because starting them is the default behaviour." - fi - # No user interaction, libc6 restart services for example - export DEBIAN_FRONTEND=noninteractive - - apt-get update - - # Install Keys - __apt_get_install_noinput debian-archive-keyring && apt-get update - if ! __check_command_exists git; then __apt_get_install_noinput git || return 1 fi @@ -2870,21 +2860,6 @@ install_debian_git_deps() { CONFIG_SALT_FUNC="config_salt" fi - if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then - __check_pip_allowed "You need to allow pip based installations (-P) in order to install requested 'apache-libcloud' module" - pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" - 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 } From 661ea86335c90346220683f1aa9e7ab57ced7efd Mon Sep 17 00:00:00 2001 From: Denys Havrysh Date: Tue, 31 May 2016 10:55:39 +0300 Subject: [PATCH 24/40] Debian 7 git: install `python-tornado` and deps from SaltStack corp repo instead of using pip --- bootstrap-salt.sh | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index afd135ee2..9cee93a7d 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2720,7 +2720,7 @@ install_debian_7_deps() { SALTSTACK_DEBIAN_URL="${HTTP_VAL}://repo.saltstack.com/apt/debian/$DISTRO_MAJOR_VERSION/$repo_arch/${STABLE_REV:-latest}" echo "deb $SALTSTACK_DEBIAN_URL wheezy main" > "/etc/apt/sources.list.d/saltstack.list" - if [ "${HTTP_VAL}" = "https" ] ; then + if [ "$HTTP_VAL" = "https" ] ; then __apt_get_install_noinput ca-certificates apt-transport-https || return 1 fi @@ -2795,7 +2795,7 @@ install_debian_8_deps() { SALTSTACK_DEBIAN_URL="${HTTP_VAL}://repo.saltstack.com/apt/debian/$DISTRO_MAJOR_VERSION/$repo_arch/$STABLE_REV" echo "deb $SALTSTACK_DEBIAN_URL jessie main" > "/etc/apt/sources.list.d/saltstack.list" - if [ "${HTTP_VAL}" = "https" ] ; then + if [ "$HTTP_VAL" = "https" ] ; then __apt_get_install_noinput ca-certificates apt-transport-https || return 1 fi @@ -2839,20 +2839,11 @@ install_debian_git_deps() { __apt_get_install_noinput git || return 1 fi - __apt_get_install_noinput lsb-release python python-pkg-resources python-crypto \ - python-jinja2 python-m2crypto python-yaml msgpack-python python-pip || return 1 - __git_clone_and_checkout || return 1 - if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then - # We're on the develop branch, install whichever tornado is on the requirements file - __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" - if [ "${__REQUIRED_TORNADO}" != "" ]; then - __check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package '${__REQUIRED_TORNADO}'" - __apt_get_install_noinput python-dev - pip install -U "${__REQUIRED_TORNADO}" || return 1 - fi - fi + __apt_get_install_noinput lsb-release python python-pkg-resources python-crypto \ + python-jinja2 python-m2crypto python-yaml msgpack-python python-tornado \ + python-backports.ssl-match-hostname || return 1 # Let's trigger config_salt() if [ "$_TEMP_CONFIG_DIR" = "null" ]; then From dd8aeac6c578d97e57d33641a8292e088ed404cc Mon Sep 17 00:00:00 2001 From: Mike Place Date: Tue, 7 Jun 2016 12:32:49 -0600 Subject: [PATCH 25/40] Always refresh the Arch Linux keyring if needed --- bootstrap-salt.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 8f012729c..e10d3540c 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4118,6 +4118,8 @@ install_arch_linux_stable_deps() { pacman-key --init && pacman-key --populate archlinux || return 1 fi + pacman -Sy --noconfirm --needed archlinux-keyring || return 1 + pacman -Sy --noconfirm --needed pacman || return 1 if __check_command_exists pacman-db-upgrade; then From 8bb534832e41afe1f5f9adb764bc2a125f1a18b2 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Wed, 8 Jun 2016 14:57:43 -0600 Subject: [PATCH 26/40] display actual invocation name Port of https://github.com/saltstack/salt/pull/32742 to bootstrap. --- bootstrap-salt.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index e10d3540c..bf204eb31 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -19,7 +19,7 @@ set -o nounset # Treat unset variables as an error __ScriptVersion="2016.05.11" -__ScriptName="bootstrap-salt.sh" +__ScriptName="${0}" #====================================================================================================================== # Environment variables taken into account. @@ -670,8 +670,8 @@ trap "__exit_cleanup" EXIT INT # Define our logging file and pipe paths -LOGFILE="/tmp/$( echo $__ScriptName | sed s/.sh/.log/g )" -LOGPIPE="/tmp/$( echo $__ScriptName | sed s/.sh/.logpipe/g )" +LOGFILE="/tmp/$( echo "$__ScriptName" | sed s/.sh/.log/g )" +LOGPIPE="/tmp/$( echo "$__ScriptName" | sed s/.sh/.logpipe/g )" # Create our logging pipe # On FreeBSD we have to use mkfifo instead of mknod From d131ce7b077b71eafdf58e46eaa8460558b31041 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Wed, 8 Jun 2016 15:18:07 -0600 Subject: [PATCH 27/40] print command line arguments in output header info --- bootstrap-salt.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index bf204eb31..3947821b8 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -604,7 +604,8 @@ if [ -d "$_VIRTUALENV_DIR" ]; then exit 1 fi -echoinfo "${CALLER} ${0} -- Version ${__ScriptVersion}" +echoinfo "Running version: ${__ScriptVersion}" +echoinfo "Command line: \"${CALLER} ${0} ${*}\"" echowarn "Running the unstable version of ${__ScriptName}" #--- FUNCTION ------------------------------------------------------------------------------------------------------- From b065718d6d1597d3fc0abbb107acf0aed6f3d28c Mon Sep 17 00:00:00 2001 From: rallytime Date: Thu, 9 Jun 2016 08:56:44 -0600 Subject: [PATCH 28/40] Update supported Ubuntu distros docs --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 05978a5fb..9c597a1f3 100644 --- a/README.rst +++ b/README.rst @@ -238,7 +238,7 @@ Ubuntu and derivatives - Linaro 12.04 - Linux Mint 13/14/16/17 - Trisquel GNU/Linux 6 (based on Ubuntu 12.04) -- Ubuntu 10.x/11.x/12.x/13.x/14.x/15.04 +- Ubuntu 10.x/11.x/12.x/13.x/14.x/15.x/16.04 Other Linux distro From 01ad3d8febdc756e2f223bfe9d78af5c2b865a1f Mon Sep 17 00:00:00 2001 From: Robert James Hernandez Date: Thu, 9 Jun 2016 20:30:54 -0700 Subject: [PATCH 29/40] Exclude path of script when called from another dir --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 3947821b8..d2b70c056 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -19,7 +19,7 @@ set -o nounset # Treat unset variables as an error __ScriptVersion="2016.05.11" -__ScriptName="${0}" +__ScriptName="$(basename ${0})" #====================================================================================================================== # Environment variables taken into account. From 254a1b2b1b14b3dc0d9dabe543cabea6e4b20548 Mon Sep 17 00:00:00 2001 From: rallytime Date: Thu, 9 Jun 2016 11:18:30 -0600 Subject: [PATCH 30/40] Add -R option to allow a custom repo URL --- bootstrap-salt.sh | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index e10d3540c..532f46621 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -231,6 +231,7 @@ _NO_DEPS=$BS_FALSE _FORCE_SHALLOW_CLONE=$BS_FALSE _DISABLE_SSL=$BS_FALSE _DISABLE_REPOS=$BS_FALSE +_CUSTOM_REPO_URL="null" _CUSTOM_MASTER_CONFIG="null" _CUSTOM_MINION_CONFIG="null" @@ -330,11 +331,15 @@ __usage() { possible. -V Install salt into virtualenv(Only available for Ubuntu base distributions) -a Pip install all python pkg dependencies for salt. Requires -V to install - all pip pkgs into the virtualenv(Only available for Ubuntu base + all pip pkgs into the virtualenv(Only available for Ubuntu based distributions) -r Disable all repository configuration performed by this script. This option assumes all necessary repository configuration is already present on the system. + -R Specify a custom repository URL. Assumes the custom repository URL points + to a repository that rsyncs Salt packages located at repo.saltstack.com. + The option passed with -R replaces "repo.saltstack.com". If -R is passed, + -r is also set. Currently only works on CentOS/RHEL based distributions. -J Replace the Master config file with data passed in as a json string. If a Master config file is found, a reasonable effort will be made to save the file with a ".bak" extension. If used in conjunction with -C or -F, no ".bak" @@ -350,7 +355,7 @@ EOT } # ---------- end of function __usage ---------- -while getopts ":hvnDc:Gg:wk:s:MSNXCPFUKIA:i:Lp:dH:ZbflV:J:j:ar" opt +while getopts ":hvnDc:Gg:wk:s:MSNXCPFUKIA:i:Lp:dH:ZbflV:J:j:rR:a" opt do case "${opt}" in @@ -414,6 +419,7 @@ do V ) _VIRTUALENV_DIR="$OPTARG" ;; a ) _PIP_ALL=$BS_TRUE ;; r ) _DISABLE_REPOS=$BS_TRUE ;; + R ) _CUSTOM_REPO_URL=$OPTARG ;; J ) _CUSTOM_MASTER_CONFIG=$OPTARG ;; j ) _CUSTOM_MINION_CONFIG=$OPTARG ;; @@ -541,6 +547,12 @@ if [ "$ITYPE" != "git" ]; then fi fi +# Check for -r if -R is being passed. Set -r with a warning. +if [ "$_CUSTOM_REPO_URL" != "null" ] && [ "$_DISABLE_REPOS" -eq $BS_FALSE ]; then + echowarn "Detected -R option. No other repositories will be configured when -R is used. Setting -r option to True." + _DISABLE_REPOS=$BS_TRUE +fi + # Check for any unparsed arguments. Should be an error. if [ "$#" -gt 0 ]; then __check_unparsed_options "$*" @@ -3306,8 +3318,15 @@ __install_saltstack_rhel_repository() { repo_rev="latest" fi - base_url="${HTTP_VAL}://repo.saltstack.com/yum/redhat/\$releasever/\$basearch/${repo_rev}/" - fetch_url="${HTTP_VAL}://repo.saltstack.com/yum/redhat/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/${repo_rev}/" + # Check if a custom repo URL was passed with -R. If not, use repo.salstack.com. + if [ "$_CUSTOM_REPO_URL" != "null" ]; then + repo_url="$_CUSTOM_REPO_URL" + else + repo_url="repo.saltstack.com" + fi + + base_url="${HTTP_VAL}://${repo_url}/yum/redhat/\$releasever/\$basearch/${repo_rev}/" + fetch_url="${HTTP_VAL}://${repo_url}/yum/redhat/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/${repo_rev}/" if [ "${DISTRO_MAJOR_VERSION}" -eq 5 ]; then gpg_key="SALTSTACK-EL5-GPG-KEY.pub" @@ -3335,7 +3354,7 @@ _eof # Import CentOS 7 GPG key on RHEL for installing base dependencies from # Salt corporate repository rpm -qa gpg-pubkey\* --qf "%{name}-%{version}\n" | grep -q ^gpg-pubkey-f4a80eb5$ || \ - __rpm_import_gpg "${HTTP_VAL}://repo.saltstack.com/yum/redhat/7/x86_64/${repo_rev}/base/RPM-GPG-KEY-CentOS-7" || return 1 + __rpm_import_gpg "${HTTP_VAL}://${repo_url}/yum/redhat/7/x86_64/${repo_rev}/base/RPM-GPG-KEY-CentOS-7" || return 1 fi return 0 @@ -3371,6 +3390,13 @@ install_centos_stable_deps() { __install_saltstack_rhel_repository || return 1 fi + # If -R was passed, we need to configure custom repo url with rsync-ed packages + # Which is still handled in __install_saltstack_rhel_repository. This call has + # its own check in case -r was passed without -R. + if [ "$_CUSTOM_REPO_URL" != "null" ]; then + __install_saltstack_rhel_repository || return 1 + 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 __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" From 49d4fae62cf1d018194ca27e2298775215380c28 Mon Sep 17 00:00:00 2001 From: rallytime Date: Fri, 17 Jun 2016 13:06:10 -0600 Subject: [PATCH 31/40] Don't be so specific with using "rsync" --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 532f46621..81fef9435 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -337,7 +337,7 @@ __usage() { option assumes all necessary repository configuration is already present on the system. -R Specify a custom repository URL. Assumes the custom repository URL points - to a repository that rsyncs Salt packages located at repo.saltstack.com. + to a repository that mirrors Salt packages located at repo.saltstack.com. The option passed with -R replaces "repo.saltstack.com". If -R is passed, -r is also set. Currently only works on CentOS/RHEL based distributions. -J Replace the Master config file with data passed in as a json string. If a From f5e89198447cc6dd85ccd58628751d9128a7ed2d Mon Sep 17 00:00:00 2001 From: twangboy Date: Fri, 17 Jun 2016 16:03:01 -0600 Subject: [PATCH 32/40] Add repourl option --- bootstrap-salt.ps1 | 250 ++++++++++++++++++++++++++------------------- 1 file changed, 145 insertions(+), 105 deletions(-) diff --git a/bootstrap-salt.ps1 b/bootstrap-salt.ps1 index b97032f15..69e6a4db8 100644 --- a/bootstrap-salt.ps1 +++ b/bootstrap-salt.ps1 @@ -1,79 +1,91 @@ <# .SYNOPSIS -A simple Powershell script to download and install a salt minion on windows. + A simple Powershell script to download and install a salt minion on windows. .DESCRIPTION -The script will download the official salt package from saltstack. It will install a specific -package version and accept parameters for the master and minion ids. Finally, it can stop and -set the windows service to "manual" for local testing. + The script will download the official salt package from saltstack. It will + install a specific package version and accept parameters for the master and + minion ids. Finally, it can stop and set the windows service to "manual" for + local testing. .EXAMPLE -./bootstrap-salt.ps1 -Runs without any parameters. Uses all the default values/settings. + ./bootstrap-salt.ps1 + Runs without any parameters. Uses all the default values/settings. .EXAMPLE -./bootstrap-salt.ps1 -version 2015.4.1-3 -Specifies a particular version of the installer. + ./bootstrap-salt.ps1 -version 2015.4.1-3 + Specifies a particular version of the installer. .EXAMPLE -./bootstrap-salt.ps1 -runservice false -Specifies the salt-minion service to stop and be set to manual. -Useful for testing locally from the command line with the --local switch + ./bootstrap-salt.ps1 -runservice false + Specifies the salt-minion service to stop and be set to manual. Useful for + testing locally from the command line with the --local switch .EXAMPLE -./bootstrap-salt.ps1 -minion minion-box -master master-box -Specifies the minion and master ids in the minion config. -Defaults to the installer values of host name for the minion id and "salt" for the master. + ./bootstrap-salt.ps1 -minion minion-box -master master-box + Specifies the minion and master ids in the minion config. Defaults to the + installer values of host name for the minion id and "salt" for the master. .EXAMPLE -./bootstrap-salt.ps1 -minion minion-box -master master-box -version 2015.5.2 -runservice false -Specifies all the optional parameters in no particular order. + ./bootstrap-salt.ps1 -minion minion-box -master master-box -version 2015.5.2 -runservice false + Specifies all the optional parameters in no particular order. -.PARAMETER version - Default version defined in this script. +.PARAMETER version + Default version defined in this script. -.PARAMETER runservice - Boolean flag to stop the windows service and set to "manual". - Installer starts it by default. +.PARAMETER runservice + Boolean flag to start or stop the minion service. True will start the minion + service. False will stop the minion service and set it to "manual". The + installer starts it by default. -.PARAMETER minion - Name of the minion being installed on this host. - Installer defaults to the host name. +.PARAMETER minion + Name of the minion being installed on this host. Installer defaults to the + host name. -.PARAMETER master - Name or IP of the master server the minion. Installer defaults to "salt". +.PARAMETER master + Name or IP of the master server. Installer defaults to "salt". + +.PARAMETER repourl + URL to the windows packages. Default is "http://repo.saltstack.com/windows" .NOTES -All of the parameters are optional. The default should be the latest version. The architecture -is dynamically determined by the script. + All of the parameters are optional. The default should be the latest + version. The architecture is dynamically determined by the script. .LINK -Bootstrap GitHub Project (script home) - https://github.com/saltstack/salt-windows-bootstrap -Original Vagrant Provisioner Project -https://github.com/saltstack/salty-vagrant -Vagrant Project (utilizes this script) - https://github.com/mitchellh/vagrant -SaltStack Download Location - https://repo.saltstack.com/windows/ + Bootstrap GitHub Project (script home) - https://github.com/saltstack/salt-windows-bootstrap + Original Vagrant Provisioner Project -https://github.com/saltstack/salty-vagrant + Vagrant Project (utilizes this script) - https://github.com/mitchellh/vagrant + SaltStack Download Location - https://repo.saltstack.com/windows/ #> -#============================================================================== +#=============================================================================== # Commandlet Binding -#============================================================================== +#=============================================================================== [CmdletBinding()] Param( - [Parameter(Mandatory=$false,ValueFromPipeline=$true)] - # Doesn't support versions prior to "YYYY.M.R-B" - [ValidatePattern('^201\d\.\d{1,2}\.\d{1,2}(\-\d{1})?|(rc\d)$')] - [string]$version = '', - - [Parameter(Mandatory=$false,ValueFromPipeline=$true)] - [ValidateSet("true","false")] - [string]$runservice = "true", - - [Parameter(Mandatory=$false,ValueFromPipeline=$true)] - [string]$minion = "not-specified", - - [Parameter(Mandatory=$false,ValueFromPipeline=$true)] - [string]$master = "not-specified" + [Parameter(Mandatory=$false,ValueFromPipeline=$true)] + # Doesn't support versions prior to "YYYY.M.R-B" + [ValidatePattern('^201\d\.\d{1,2}\.\d{1,2}(\-\d{1})?|(rc\d)$')] + [string]$version = '', + + [Parameter(Mandatory=$false,ValueFromPipeline=$true)] + [ValidateSet("true","false")] + [string]$runservice = "true", + + [Parameter(Mandatory=$false,ValueFromPipeline=$true)] + [string]$minion = "not-specified", + + [Parameter(Mandatory=$false,ValueFromPipeline=$true)] + [string]$master = "not-specified", + + [Parameter(Mandatory=$false,ValueFromPipeline=$true)] + [string]$repourl= "http://repo.saltstack.com/windows" ) -#============================================================================== +#=============================================================================== # Script Functions -#============================================================================== +#=============================================================================== function Get-IsAdministrator { $Identity = [System.Security.Principal.WindowsIdentity]::GetCurrent() @@ -86,9 +98,9 @@ function Get-IsUacEnabled (Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System).EnableLua -ne 0 } -#============================================================================== +#=============================================================================== # Check for Elevated Privileges -#============================================================================== +#=============================================================================== If (!(Get-IsAdministrator)) { If (Get-IsUacEnabled) { # We are not running "as Administrator" - so relaunch as administrator @@ -114,87 +126,106 @@ If (!(Get-IsAdministrator)) { # Exit from the current, unelevated, process Exit - - } Else { + } + Else { Throw "You must be administrator to run this script" } } +#=============================================================================== +# Verify Parameters +#=============================================================================== Write-Verbose "Parameters passed in:" Write-Verbose "version: $version" Write-Verbose "runservice: $runservice" Write-Verbose "master: $master" Write-Verbose "minion: $minion" +Write-Verbose "repourl: $repourl" -If ($runservice.ToLower() -eq "true"){ - Write-Verbose "Windows service will be set to run" - [bool]$runservice = $True +If ($runservice.ToLower() -eq "true") { + Write-Verbose "Windows service will be set to run" + [bool]$runservice = $True } -ElseIf ($runservice.ToLower() -eq "false"){ - Write-Verbose "Windows service will be stopped and set to manual" - [bool]$runservice = $False +ElseIf ($runservice.ToLower() -eq "false") { + Write-Verbose "Windows service will be stopped and set to manual" + [bool]$runservice = $False } Else { - # Param passed in wasn't clear so defaulting to true. - Write-Verbose "Windows service defaulting to run automatically" - [bool]$runservice = $True + # Param passed in wasn't clear so defaulting to true. + Write-Verbose "Windows service defaulting to run automatically" + [bool]$runservice = $True } -# Create C:\tmp\ - if Vagrant doesn't upload keys and/or config it might not exist +#=============================================================================== +# Ensure Directories are present, copy Vagrant Configs if found +#=============================================================================== +# Create C:\tmp\ New-Item C:\tmp\ -ItemType directory -Force | Out-Null -# Copy minion keys & config to correct location -New-Item C:\salt\conf\pki\minion\ -ItemType Directory -Force | Out-Null - -# Check if minion keys have been uploaded +# Copy Vagrant Files to their proper location. Vagrant files will be placed +# in C:\tmp +# Check if minion keys have been uploaded, copy to correct location If (Test-Path C:\tmp\minion.pem) { - cp C:\tmp\minion.pem C:\salt\conf\pki\minion\ - cp C:\tmp\minion.pub C:\salt\conf\pki\minion\ + New-Item C:\salt\conf\pki\minion\ -ItemType Directory -Force | Out-Null + # Copy minion keys & config to correct location + cp C:\tmp\minion.pem C:\salt\conf\pki\minion\ + cp C:\tmp\minion.pub C:\salt\conf\pki\minion\ } # Check if minion config has been uploaded # This should be done before the installer is run so that it can be updated with # id: and master: settings when the installer runs If (Test-Path C:\tmp\minion) { - Copy-Item -Path C:\tmp\minion -Destination C:\salt\conf\ -Force | Out-Null + New-Item C:\salt\conf\ -ItemType Directory -Force | Out-Null + Copy-Item -Path C:\tmp\minion -Destination C:\salt\conf\ -Force | Out-Null } +#=============================================================================== # Detect architecture +#=============================================================================== If ([IntPtr]::Size -eq 4) { - $arch = "x86" -} Else { - $arch = "AMD64" + $arch = "x86" +} +Else { + $arch = "AMD64" } +#=============================================================================== +# Figure out the latest version if no version is passed +#=============================================================================== # If version isn't supplied, use latest. -if (!$version) { - # Find latest version of Salt Minion - $repo = Invoke-Restmethod 'http://repo.saltstack.com/windows/' +If (!$version) { + # Find latest version of Salt Minion + $repo = Invoke-Restmethod "$repourl" $regex = "<\s*a\s*[^>]*?href\s*=\s*[`"']*([^`"'>]+)[^>]*?>" $returnMatches = New-Object System.Collections.ArrayList $resultingMatches = [Regex]::Matches($repo, $regex, "IgnoreCase") - foreach($match in $resultingMatches) - { + foreach($match in $resultingMatches) { $cleanedMatch = $match.Groups[1].Value.Trim() [void] $returnMatches.Add($cleanedMatch) - } - if ($arch -eq 'x86') {$returnMatches = $returnMatches | Where {$_ -like "Salt-Minion*x86-Setup.exe"}} - else {$returnMatches = $returnMatches | Where {$_ -like "Salt-Minion*AMD64-Setup.exe"}} + } + If ($arch -eq 'x86') { + $returnMatches = $returnMatches | Where {$_ -like "Salt-Minion*x86-Setup.exe"} + } + Else { + $returnMatches = $returnMatches | Where {$_ -like "Salt-Minion*AMD64-Setup.exe"} + } - $version = $(($returnMatches | Sort-Object -Descending)[0]).Split(("n-","-A","-x"),([System.StringSplitOptions]::RemoveEmptyEntries))[1] + $version = $(($returnMatches | Sort-Object -Descending)[0]).Split(("n-","-A","-x"),([System.StringSplitOptions]::RemoveEmptyEntries))[1] } +#=============================================================================== # Download minion setup file +#=============================================================================== Write-Output "Downloading Salt minion installer Salt-Minion-$version-$arch-Setup.exe" $webclient = New-Object System.Net.WebClient -$url = "https://repo.saltstack.com/windows/Salt-Minion-$version-$arch-Setup.exe" +$url = "$repourl/Salt-Minion-$version-$arch-Setup.exe" $file = "C:\tmp\salt.exe" $webclient.DownloadFile($url, $file) -# Install minion silently -Write-Output "Installing Salt minion" - +#=============================================================================== # Set the parameters for the installer +#=============================================================================== # Unless specified, use the installer defaults # - id: # - master: salt @@ -204,10 +235,16 @@ If($minion -ne "not-specified") {$parameters = "/minion-name=$minion"} If($master -ne "not-specified") {$parameters = "$parameters /master=$master"} If($runservice -eq $false) {$parameters = "$parameters /start-service=0"} +#=============================================================================== +# Install minion silently +#=============================================================================== #Wait for process to exit before continuing. +Write-Output "Installing Salt minion" Start-Process C:\tmp\salt.exe -ArgumentList "/S $parameters" -Wait -NoNewWindow -PassThru | Out-Null - +#=============================================================================== +# Configure the minion service +#=============================================================================== # Wait for salt-minion service to be registered before trying to start it $service = Get-Service salt-minion -ErrorAction SilentlyContinue While (!$service) { @@ -216,30 +253,33 @@ While (!$service) { } If($runservice) { - # Start service - Start-Service -Name "salt-minion" -ErrorAction SilentlyContinue - - # Check if service is started, otherwise retry starting the - # service 4 times. - $try = 0 - While (($service.Status -ne "Running") -and ($try -ne 4)) { + # Start service Start-Service -Name "salt-minion" -ErrorAction SilentlyContinue - $service = Get-Service salt-minion -ErrorAction SilentlyContinue - Start-Sleep -s 2 - $try += 1 - } - - # If the salt-minion service is still not running, something probably - # went wrong and user intervention is required - report failure. - If ($service.Status -eq "Stopped") { - Write-Output -NoNewline "Failed to start salt minion" - exit 1 - } + + # Check if service is started, otherwise retry starting the + # service 4 times. + $try = 0 + While (($service.Status -ne "Running") -and ($try -ne 4)) { + Start-Service -Name "salt-minion" -ErrorAction SilentlyContinue + $service = Get-Service salt-minion -ErrorAction SilentlyContinue + Start-Sleep -s 2 + $try += 1 + } + + # If the salt-minion service is still not running, something probably + # went wrong and user intervention is required - report failure. + If ($service.Status -eq "Stopped") { + Write-Output -NoNewline "Failed to start salt minion" + exit 1 + } } Else { - Write-Output -NoNewline "Stopping salt minion and setting it to 'Manual'" - Set-Service "salt-minion" -StartupType "Manual" - Stop-Service "salt-minion" + Write-Output -NoNewline "Stopping salt minion and setting it to 'Manual'" + Set-Service "salt-minion" -StartupType "Manual" + Stop-Service "salt-minion" } +#=============================================================================== +# Script Complete +#=============================================================================== Write-Output "Salt minion successfully installed" From 22d68ff496be4f5686208920119951d4047ad550 Mon Sep 17 00:00:00 2001 From: twangboy Date: Fri, 17 Jun 2016 16:36:48 -0600 Subject: [PATCH 33/40] Change to https as default --- bootstrap-salt.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.ps1 b/bootstrap-salt.ps1 index 69e6a4db8..2bff69e39 100644 --- a/bootstrap-salt.ps1 +++ b/bootstrap-salt.ps1 @@ -46,7 +46,7 @@ Name or IP of the master server. Installer defaults to "salt". .PARAMETER repourl - URL to the windows packages. Default is "http://repo.saltstack.com/windows" + URL to the windows packages. Default is "https://repo.saltstack.com/windows" .NOTES All of the parameters are optional. The default should be the latest @@ -80,7 +80,7 @@ Param( [string]$master = "not-specified", [Parameter(Mandatory=$false,ValueFromPipeline=$true)] - [string]$repourl= "http://repo.saltstack.com/windows" + [string]$repourl= "https://repo.saltstack.com/windows" ) #=============================================================================== From e69ba1840bee8c8a3da2298089833c7c6f1a7a79 Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Tue, 21 Jun 2016 16:30:26 -0600 Subject: [PATCH 34/40] fix lint --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 35e17c61c..71931a5bd 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -19,7 +19,7 @@ set -o nounset # Treat unset variables as an error __ScriptVersion="2016.05.11" -__ScriptName="$(basename ${0})" +__ScriptName="$(basename "${0}")" #====================================================================================================================== # Environment variables taken into account. From b915f9b3d970eb32df49edbd0e292d782aef44cd Mon Sep 17 00:00:00 2001 From: Nasenbaer Date: Mon, 30 May 2016 13:48:48 +0200 Subject: [PATCH 35/40] Add option to make setup.py install quiet --- bootstrap-salt.sh | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index c0a251c6d..83c7ebebb 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -234,7 +234,7 @@ _DISABLE_REPOS=$BS_FALSE _CUSTOM_REPO_URL="null" _CUSTOM_MASTER_CONFIG="null" _CUSTOM_MINION_CONFIG="null" - +_QUIET_GIT_INSTALLATION=$BS_FALSE #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: __usage @@ -350,6 +350,7 @@ __usage() { file with a ".bak" extension. If used in conjunction with -C or -F, no ".bak" file will be created as either of those options will force a complete overwrite of the file. + -q Quiet salt installation from git (setup.py install -q) EOT } # ---------- end of function __usage ---------- @@ -422,6 +423,7 @@ do R ) _CUSTOM_REPO_URL=$OPTARG ;; J ) _CUSTOM_MASTER_CONFIG=$OPTARG ;; j ) _CUSTOM_MINION_CONFIG=$OPTARG ;; + q ) _QUIET_GIT_INSTALLATION=$BS_TRUE ;; \?) echo echoerror "Option does not exist : $OPTARG" @@ -569,6 +571,13 @@ 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 + SETUP_PY_INSTALL_ARGS="-q" +else + SETUP_PY_INSTALL_ARGS="" +fi + # whoami alternative for SunOS if [ -f /usr/xpg4/bin/id ]; then whoami='/usr/xpg4/bin/id -un' @@ -2485,9 +2494,9 @@ install_ubuntu_git() { fi if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install --install-layout=deb || return 1 + python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install "${SETUP_PY_INSTALL_ARGS}" --install-layout=deb || return 1 else - python setup.py install --install-layout=deb || return 1 + python setup.py install "${SETUP_PY_INSTALL_ARGS}" --install-layout=deb || return 1 fi return 0 } @@ -2956,9 +2965,9 @@ install_debian_8_stable() { install_debian_git() { if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install --install-layout=deb || return 1 + python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install "${SETUP_PY_INSTALL_ARGS}" --install-layout=deb || return 1 else - python setup.py install --install-layout=deb || return 1 + python setup.py install "${SETUP_PY_INSTALL_ARGS}" --install-layout=deb || return 1 fi } @@ -3192,9 +3201,9 @@ install_fedora_git_deps() { install_fedora_git() { if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install || return 1 + python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install "${SETUP_PY_INSTALL_ARGS}" || return 1 else - python setup.py install || return 1 + python setup.py install "${SETUP_PY_INSTALL_ARGS}" || return 1 fi return 0 } @@ -3567,9 +3576,9 @@ install_centos_git() { _PYEXE=python2 fi if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - $_PYEXE setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install --prefix=/usr || return 1 + $_PYEXE setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install "${SETUP_PY_INSTALL_ARGS}" --prefix=/usr || return 1 else - $_PYEXE setup.py install --prefix=/usr || return 1 + $_PYEXE setup.py install "${SETUP_PY_INSTALL_ARGS}" --prefix=/usr || return 1 fi return 0 } @@ -4212,9 +4221,9 @@ install_arch_linux_stable() { install_arch_linux_git() { if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - python2 setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install || return 1 + python2 setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install "${SETUP_PY_INSTALL_ARGS}" || return 1 else - python2 setup.py install || return 1 + python2 setup.py install "${SETUP_PY_INSTALL_ARGS}" || return 1 fi return 0 } @@ -4552,7 +4561,7 @@ install_freebsd_git() { # Install from git if [ ! -f salt/syspaths.py ]; then # We still can't provide the system paths, salt 0.16.x - /usr/local/bin/python2 setup.py install || return 1 + /usr/local/bin/python2 setup.py install "${SETUP_PY_INSTALL_ARGS}" || return 1 else /usr/local/bin/python2 setup.py \ --salt-root-dir=/usr/local \ @@ -4564,7 +4573,7 @@ install_freebsd_git() { --salt-base-pillar-roots-dir="${_SALT_ETC_DIR}/pillar" \ --salt-base-master-roots-dir="${_SALT_ETC_DIR}/salt-master" \ --salt-logs-dir=/var/log/salt \ - --salt-pidfile-dir=/var/run install \ + --salt-pidfile-dir=/var/run install "${SETUP_PY_INSTALL_ARGS}" \ || return 1 fi @@ -4758,7 +4767,7 @@ install_openbsd_git() { # if [ ! -f salt/syspaths.py ]; then # We still can't provide the system paths, salt 0.16.x - /usr/local/bin/python2.7 setup.py install || return 1 + /usr/local/bin/python2.7 setup.py install "${SETUP_PY_INSTALL_ARGS}" || return 1 fi return 0 } @@ -4919,7 +4928,7 @@ install_smartos_stable() { install_smartos_git() { # Use setuptools in order to also install dependencies # lets force our config path on the setup for now, since salt/syspaths.py only got fixed in 2015.5.0 - USE_SETUPTOOLS=1 /opt/local/bin/python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install || return 1 + USE_SETUPTOOLS=1 /opt/local/bin/python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install "${SETUP_PY_INSTALL_ARGS}" || return 1 return 0 } @@ -5153,7 +5162,7 @@ install_opensuse_stable() { } install_opensuse_git() { - python setup.py install --prefix=/usr || return 1 + python setup.py install "${SETUP_PY_INSTALL_ARGS}" --prefix=/usr || return 1 return 0 } From 2c5f77506a34772ef26cf5fc0796f5d8350e0bce Mon Sep 17 00:00:00 2001 From: Nasenbaer Date: Wed, 1 Jun 2016 13:45:53 +0200 Subject: [PATCH 36/40] Fix getopts and argument position --- bootstrap-salt.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 83c7ebebb..30cd18586 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -356,7 +356,7 @@ EOT } # ---------- end of function __usage ---------- -while getopts ":hvnDc:Gg:wk:s:MSNXCPFUKIA:i:Lp:dH:ZbflV:J:j:rR:a" opt +while getopts ":hvnDc:Gg:wk:s:MSNXCPFUKIA:i:Lp:dH:ZbflV:J:j:rR:aq" opt do case "${opt}" in @@ -2494,9 +2494,9 @@ install_ubuntu_git() { fi if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install "${SETUP_PY_INSTALL_ARGS}" --install-layout=deb || return 1 + python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install --install-layout=deb || return 1 else - python setup.py install "${SETUP_PY_INSTALL_ARGS}" --install-layout=deb || return 1 + python setup.py ${SETUP_PY_INSTALL_ARGS} install--install-layout=deb || return 1 fi return 0 } @@ -2965,9 +2965,9 @@ install_debian_8_stable() { install_debian_git() { if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install "${SETUP_PY_INSTALL_ARGS}" --install-layout=deb || return 1 + python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install --install-layout=deb || return 1 else - python setup.py install "${SETUP_PY_INSTALL_ARGS}" --install-layout=deb || return 1 + python setup.py ${SETUP_PY_INSTALL_ARGS} install --install-layout=deb || return 1 fi } @@ -3201,9 +3201,9 @@ install_fedora_git_deps() { install_fedora_git() { if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install "${SETUP_PY_INSTALL_ARGS}" || return 1 + python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install || return 1 else - python setup.py install "${SETUP_PY_INSTALL_ARGS}" || return 1 + python setup.py ${SETUP_PY_INSTALL_ARGS} install || return 1 fi return 0 } @@ -3576,9 +3576,9 @@ install_centos_git() { _PYEXE=python2 fi if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - $_PYEXE setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install "${SETUP_PY_INSTALL_ARGS}" --prefix=/usr || return 1 + $_PYEXE setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install --prefix=/usr || return 1 else - $_PYEXE setup.py install "${SETUP_PY_INSTALL_ARGS}" --prefix=/usr || return 1 + $_PYEXE setup.py ${SETUP_PY_INSTALL_ARGS} install --prefix=/usr || return 1 fi return 0 } @@ -4221,9 +4221,9 @@ install_arch_linux_stable() { install_arch_linux_git() { if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then - python2 setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install "${SETUP_PY_INSTALL_ARGS}" || return 1 + python2 setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install || return 1 else - python2 setup.py install "${SETUP_PY_INSTALL_ARGS}" || return 1 + python2 setup.py ${SETUP_PY_INSTALL_ARGS} install || return 1 fi return 0 } @@ -4561,7 +4561,7 @@ install_freebsd_git() { # Install from git if [ ! -f salt/syspaths.py ]; then # We still can't provide the system paths, salt 0.16.x - /usr/local/bin/python2 setup.py install "${SETUP_PY_INSTALL_ARGS}" || return 1 + /usr/local/bin/python2 setup.py ${SETUP_PY_INSTALL_ARGS} install || return 1 else /usr/local/bin/python2 setup.py \ --salt-root-dir=/usr/local \ @@ -4573,7 +4573,7 @@ install_freebsd_git() { --salt-base-pillar-roots-dir="${_SALT_ETC_DIR}/pillar" \ --salt-base-master-roots-dir="${_SALT_ETC_DIR}/salt-master" \ --salt-logs-dir=/var/log/salt \ - --salt-pidfile-dir=/var/run install "${SETUP_PY_INSTALL_ARGS}" \ + --salt-pidfile-dir=/var/run ${SETUP_PY_INSTALL_ARGS} install \ || return 1 fi @@ -4767,7 +4767,7 @@ install_openbsd_git() { # if [ ! -f salt/syspaths.py ]; then # We still can't provide the system paths, salt 0.16.x - /usr/local/bin/python2.7 setup.py install "${SETUP_PY_INSTALL_ARGS}" || return 1 + /usr/local/bin/python2.7 setup.py ${SETUP_PY_INSTALL_ARGS} install || return 1 fi return 0 } @@ -4928,7 +4928,7 @@ install_smartos_stable() { install_smartos_git() { # Use setuptools in order to also install dependencies # lets force our config path on the setup for now, since salt/syspaths.py only got fixed in 2015.5.0 - USE_SETUPTOOLS=1 /opt/local/bin/python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" install "${SETUP_PY_INSTALL_ARGS}" || return 1 + USE_SETUPTOOLS=1 /opt/local/bin/python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install || return 1 return 0 } @@ -5162,7 +5162,7 @@ install_opensuse_stable() { } install_opensuse_git() { - python setup.py install "${SETUP_PY_INSTALL_ARGS}" --prefix=/usr || return 1 + python setup.py ${SETUP_PY_INSTALL_ARGS} install --prefix=/usr || return 1 return 0 } From 683f41871abed60643cf27f5ab646ab3e30e0607 Mon Sep 17 00:00:00 2001 From: rallytime Date: Fri, 24 Jun 2016 14:11:36 -0600 Subject: [PATCH 37/40] Update the authors list with new contributors --- AUTHORS.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index 84b741043..1f5caa6c0 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -11,6 +11,7 @@ abednarik abednarik alejandro.bednarik@gmail.com Adam Wright hipikat adam@hipikat.org Alec Koumjian akoumjian akoumjian@gmail.com Alex Van't Hof alexvh +Alexander Krasnukhin themalkolm the.malkolm@gmail.com Angelo Gründler plueschopath angelo.gruendler@w1r3.net Ari Aosved devaos ari.aosved@gmail.com Beau Hargis beaucephus beau@customermobile.com @@ -27,6 +28,7 @@ Christer Edwards cedwards Clark Perkins iclarkperkins clark.perkins@digitalreasoning.com Dag Viggo Lokøen dagvl dag.viggo@lokoen.org Dan Mick dmick dan.mick@inktank.com +Daniel Poelzleithner poelzi David J. Felix DavidJFelix denmat denmat Denys Havrysh vutny denys.gavrysh@gmail.com @@ -57,6 +59,7 @@ Karl Grzeszczak karlgrz Kenneth Wilke KennethWilke lomeroe lomeroe Liu Xiaohui oreh herolxh@gmail.com +Marc Vieira-Cardinal marccadinal Mark Lee malept Marcus Furlong furlongm furlongm@gmail.com markgaylard markgaylard @@ -70,6 +73,7 @@ Michael Scherer mscherer Michele Bologna mbologna michele.bologna@gmail.com Mike Carlson m87carlson mike@bayphoto.com Mike Place cachedout mp@saltstack.com +nasenbaer13 nasenbaer13 nevins-b nevins-b Nicole Thomas rallytime nicole@saltstack.com Niels Abspoel aboe76 aboe76@gmail.com @@ -93,6 +97,7 @@ Ronald van Zantvoort The-Loeki ronald@pcextreme.nl RuriRyan RuriRyan ryan@btsoft.eu Ryan Walder ryanwalder ryanwalder@ucds.email Sergey Paramonov serge-p serg.paramonov@s-vp.com +Shane Lee twangboy slee@saltstack.com Shawn Butts shawnbutts Skyler Berg skylerberg skylertheberg@gmail.com Stanislav B stanislavb From 80731c6979fc797b2ec9405c47d01d27406b01dc Mon Sep 17 00:00:00 2001 From: Justin Findlay Date: Fri, 24 Jun 2016 15:21:38 -0600 Subject: [PATCH 38/40] save invocation command and arguments into variables So that the invocation line is correctly printed. In addition, on older shells, such as those on CentOS 5 and SLES 11, a `shift` statement results in `${*}` being undefined. Fixes d131ce7. --- bootstrap-salt.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 30cd18586..fa2d49057 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -20,6 +20,8 @@ set -o nounset # Treat unset variables as an error __ScriptVersion="2016.05.11" __ScriptName="$(basename "${0}")" +__ScriptFullName="${0}" +__ScriptArgs="${*}" #====================================================================================================================== # Environment variables taken into account. @@ -602,7 +604,7 @@ fi CALLER=$(ps -a -o pid,args | grep $$ | grep -v grep | tr -s ' ' | cut -d ' ' -f 3) if [ "${CALLER}x" = "${0}x" ]; then - CALLER="PIPED THROUGH" + CALLER="shell pipe" fi # Work around for 'Docker + salt-bootstrap failure' https://github.com/saltstack/salt-bootstrap/issues/394 @@ -626,7 +628,8 @@ if [ -d "$_VIRTUALENV_DIR" ]; then fi echoinfo "Running version: ${__ScriptVersion}" -echoinfo "Command line: \"${CALLER} ${0} ${*}\"" +echoinfo "Executed by: ${CALLER}" +echoinfo "Command line: \"${__ScriptFullName} ${__ScriptArgs}\"" echowarn "Running the unstable version of ${__ScriptName}" #--- FUNCTION ------------------------------------------------------------------------------------------------------- From f71274e54166db9fe8962ca9bfcd8e4089bf1481 Mon Sep 17 00:00:00 2001 From: rallytime Date: Fri, 24 Jun 2016 16:23:22 -0600 Subject: [PATCH 39/40] Update release changelog --- ChangeLog | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index 30b0b9de7..abcec5562 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +Version 2016.06.24: + * Save invocation command and arguments into variables. (jfindlay) #885 + * Update the authors list with new contributors. (rallytime) #884 + * Add option to make setup.py install quiet. (nasenbaer13) #865 + * Fix lint. (jfindlay) #881 + * Add -R option to allow a custom repo URL. (rallytime) #877 + * Exclude path of script when called from another dir. (l2ol33rt) #871 + * Print invocation info. (jfindlay) #869 + * Always refresh the Arch Linux keyring if needed. (cachedout) #868 + * Ubuntu 16.04 LTS Xenial Support. (notpeter) #852 + * Install Salt packages from repo.saltstack.com on Debian 7 "Wheezy". (vutny) #864 + * Drop support for Debian 6 old-old-stable "squeeze": reached end-of-life. (vutny) #860 + * Removed ubuntu version restriction for apt-get update. (marccardinal) #859 + * Fix bootstrapping from git on Debian 8 by installing latest `tornado` via pip. (vutny) #828 + * Add the ability to override master and/or minion configs from CLI. (rallytime) #841 + * Don't sleep 11 seconds if the user allowed overwrite of config files. (poelzi) #832 + Version 2016.05.11: * Only overwrite the minion config file if '-C' is passed. Otherwise, preserve it. (rallytime) #848 From 40092e5b2bbe1969e9052b9a904e16cbfed51ab6 Mon Sep 17 00:00:00 2001 From: rallytime Date: Fri, 24 Jun 2016 16:25:50 -0600 Subject: [PATCH 40/40] Update script version --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index fa2d49057..624b88148 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -18,7 +18,7 @@ #====================================================================================================================== set -o nounset # Treat unset variables as an error -__ScriptVersion="2016.05.11" +__ScriptVersion="2016.06.24" __ScriptName="$(basename "${0}")" __ScriptFullName="${0}" __ScriptArgs="${*}"