Merge branch 'develop' into stable for next stable release

This commit is contained in:
Pedro Algarvio 2014-09-09 23:07:47 +01:00
commit 46e6746e7c
3 changed files with 90 additions and 21 deletions

View file

@ -25,7 +25,7 @@ Geoff Garside geoffgarside geoff@geoffgarside.co.uk
Giuseppe Iannello giannello giuseppe.iannello@brokenloop.net
Gregory Meno GregMeno gregory.meno@inktank.com
Guillaume Derval GuillaumeDerval guillaume@guillaumederval.be
gweis
gweis gweis
Henrik Holmboe holmboe
Jeff Hui jeffh jeff@jeffhui.net
Jeff Strunk jstrunk
@ -34,6 +34,7 @@ Karl Grzeszczak karlgrz
Kenneth Wilke KennethWilke
Liu Xiaohui oreh herolxh@gmail.com
Matthew Garrett cingeyedog matt@clemson.edu
Matthew Mead-Briggs mattmb
Matthew Willson ixela
Matthieu Guegan mguegan
Mike Carlson m87carlson mike@bayphoto.com
@ -41,6 +42,7 @@ nevins-b nevins-b
Niels Abspoel aboe76
Paul Brian lifeisstillgood paul@mikadosoftware.com
Pedro Algarvio s0undt3ch pedro@algarvio.me
Pedro Paulo pedropaulovc
Raymond Barbiero visualphoenix
Roberto Aguilar rca roberto@baremetal.io
Tate Eskew tateeskew

View file

@ -1,3 +1,10 @@
Version 2014.09.09:
* Distro Support Fixes:
* Updated the URL for EPEL 7
* PIP based installations on Ubuntu 10.04 need setuptools installed
* Arch stopped providing the version information on `/etc/arch-release`
* Complete `salt-api` services checking. #450
Version 2014.08.30:
* Skip service checks for `salt-api`, since this should be an opt-in service not necessarily
meant to start at boot time.

View file

@ -17,7 +17,7 @@
# CREATED: 10/15/2012 09:49:37 PM WEST
#======================================================================================================================
set -o nounset # Treat unset variables as an error
__ScriptVersion="2014.08.30"
__ScriptVersion="2014.09.09"
__ScriptName="bootstrap-salt.sh"
#======================================================================================================================
@ -31,7 +31,7 @@ __ScriptName="bootstrap-salt.sh"
# * BS_FORCE_OVERWRITE: Force overriding copied files(config, init.d, etc)
# * BS_UPGRADE_SYS: If 1 and an option, upgrade system. Default 0.
# * BS_GENTOO_USE_BINHOST: If 1 add `--getbinpkg` to gentoo's emerge
# * BS__SALT_MASTER_ADDRESS: The IP or DNS name of the salt-master the minion should connect to
# * BS_SALT_MASTER_ADDRESS: The IP or DNS name of the salt-master the minion should connect to
# * BS_SALT_GIT_CHECKOUT_DIR: The directory where to clone Salt on git installations
#======================================================================================================================
@ -731,10 +731,11 @@ __gather_linux_system_info() {
[ ! -f "/etc/${rsource}" ] && continue # Does not exist
n=$(echo "${rsource}" | sed -e 's/[_-]release$//' -e 's/[_-]version$//')
shortname=$(echo "${n}" | tr '[:upper:]' '[:lower:]')
rv=$( (grep VERSION "/etc/${rsource}"; cat "/etc/${rsource}") | grep '[0-9]' | sed -e 'q' )
[ "${rv}" = "" ] && continue # There's no version information. Continue to next rsource
[ "${rv}" = "" ] && [ "$shortname" != "arch" ] && continue # There's no version information. Continue to next rsource
v=$(__parse_version_string "$rv")
case $(echo "${n}" | tr '[:upper:]' '[:lower:]') in
case $shortname in
redhat )
if [ "$(egrep 'CentOS' /etc/${rsource})" != "" ]; then
n="CentOS"
@ -1693,7 +1694,7 @@ install_ubuntu_deps() {
__PIP_PACKAGES=""
else
check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package 'requests'"
__apt_get_install_noinput python-pip
__apt_get_install_noinput python-setuptools python-pip
__PIP_PACKAGES="requests"
pip install requests
fi
@ -1827,6 +1828,10 @@ install_ubuntu_git_post() {
echodebug "Copying ${__SALT_GIT_CHECKOUT_DIR}/debian/salt-${fname}.init to /etc/init.d/salt-$fname"
copyfile "${__SALT_GIT_CHECKOUT_DIR}/debian/salt-${fname}.init" "/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
update-rc.d salt-$fname defaults
else
echoerror "Neither upstart not init.d was setup for salt-$fname"
@ -1840,11 +1845,13 @@ install_ubuntu_restart_daemons() {
# Ensure upstart configs are loaded
[ -f /sbin/initctl ] && /sbin/initctl reload-configuration
for fname in minion master syndic api; do
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
# Skip if not meant to be installed
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
#[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if [ -f /sbin/initctl ]; then
@ -2298,6 +2305,10 @@ install_debian_git_post() {
continue
fi
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
update-rc.d "salt-$fname" defaults
done
}
@ -2306,11 +2317,13 @@ install_debian_restart_daemons() {
[ "$_START_DAEMONS" -eq $BS_FALSE ] && return
for fname in minion master syndic api; do
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
# Skip if not meant to be installed
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ ! -f "/etc/init.d/salt-$fname" ]) && continue
#[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ ! -f "/etc/init.d/salt-$fname" ]) && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
/etc/init.d/salt-$fname stop > /dev/null 2>&1
@ -2385,6 +2398,9 @@ install_fedora_stable_post() {
[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service)
sleep 0.1
systemctl daemon-reload
@ -2427,6 +2443,9 @@ install_fedora_git_post() {
copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service"
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service)
sleep 0.1
systemctl daemon-reload
@ -2437,10 +2456,13 @@ install_fedora_restart_daemons() {
[ $_START_DAEMONS -eq $BS_FALSE ] && return
for fname in minion master syndic api; do
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
# Skip if not meant to be installed
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
#[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
systemctl stop salt-$fname > /dev/null 2>&1
@ -2495,7 +2517,7 @@ __install_epel_repository() {
elif [ "$DISTRO_MAJOR_VERSION" -eq 6 ]; then
rpm -Uvh --force "http://download.fedoraproject.org/pub/epel/6/${EPEL_ARCH}/epel-release-6-8.noarch.rpm" || return 1
elif [ "$DISTRO_MAJOR_VERSION" -eq 7 ]; then
rpm -Uvh --force "http://download.fedoraproject.org/pub/epel/7/${EPEL_ARCH}/epel-release-7-1.noarch.rpm" || return 1
rpm -Uvh --force "http://download.fedoraproject.org/pub/epel/7/${EPEL_ARCH}/e/epel-release-7-1.noarch.rpm" || return 1
else
echoerror "Failed add EPEL repository support."
return 1
@ -2589,9 +2611,12 @@ install_centos_stable() {
install_centos_stable_post() {
for fname in minion master syndic api; do
# Skip if not meant to be installed
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
#[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if [ -f /etc/init.d/salt-$fname ]; then
@ -2656,6 +2681,10 @@ install_centos_git_post() {
if [ ! -f /etc/init.d/salt-$fname ] || ([ -f /etc/init.d/salt-$fname ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then
copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}" /etc/init.d/
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
/sbin/chkconfig salt-${fname} on
fi
@ -2680,9 +2709,12 @@ install_centos_restart_daemons() {
for fname in minion master syndic api; do
# Skip if not meant to be installed
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
#[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if [ -f /sbin/initctl ] && [ -f /etc/init/salt-${fname}.conf ]; then
@ -3355,6 +3387,9 @@ install_arch_linux_post() {
copyfile "$_SALT_ETC_DIR/$fname.pacorig" "$_SALT_ETC_DIR/$fname" $BS_TRUE
fi
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
if [ -f /usr/bin/systemctl ]; then
# Using systemd
/usr/bin/systemctl is-enabled salt-$fname.service > /dev/null 2>&1 || (
@ -3382,6 +3417,9 @@ install_arch_linux_git_post() {
if [ -f /usr/bin/systemctl ]; then
copyfile "${__SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service"
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
/usr/bin/systemctl is-enabled salt-${fname}.service > /dev/null 2>&1 || (
/usr/bin/systemctl preset salt-${fname}.service > /dev/null 2>&1 &&
/usr/bin/systemctl enable salt-${fname}.service > /dev/null 2>&1
@ -3401,11 +3439,13 @@ install_arch_linux_restart_daemons() {
[ $_START_DAEMONS -eq $BS_FALSE ] && return
for fname in minion master syndic api; do
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
# Skip if not meant to be installed
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
#[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if [ -f /usr/bin/systemctl ]; then
@ -3636,6 +3676,9 @@ install_freebsd_git() {
install_freebsd_9_stable_post() {
for fname in minion master syndic api; do
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
# Skip if not meant to be installed
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
@ -3669,11 +3712,13 @@ install_freebsd_restart_daemons() {
[ $_START_DAEMONS -eq $BS_FALSE ] && return
for fname in minion master syndic api; do
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
# Skip if not meant to be installed
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
#[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
service salt_$fname stop > /dev/null 2>&1
@ -3807,11 +3852,13 @@ install_smartos_restart_daemons() {
[ $_START_DAEMONS -eq $BS_FALSE ] && return
for fname in minion master syndic api; do
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
# Skip if not meant to be installed
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
#[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
# Stop if running && Start service
@ -3914,11 +3961,13 @@ install_opensuse_git() {
install_opensuse_stable_post() {
for fname in minion master syndic api; do
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
# Skip if not meant to be installed
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
#[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if [ -f /bin/systemctl ]; then
@ -3960,11 +4009,13 @@ install_opensuse_restart_daemons() {
[ $_START_DAEMONS -eq $BS_FALSE ] && return
for fname in minion master syndic api; do
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
# Skip if not meant to be installed
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
#[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if [ -f /bin/systemctl ]; then
@ -4274,11 +4325,13 @@ install_gentoo_git() {
install_gentoo_post() {
for fname in minion master syndic api; do
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
# Skip if not meant to be installed
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
#[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if [ -d "/run/systemd/system" ]; then
@ -4295,11 +4348,13 @@ install_gentoo_restart_daemons() {
[ $_START_DAEMONS -eq $BS_FALSE ] && return
for fname in minion master syndic api; do
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
# Skip if not meant to be installed
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
#[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if [ -d "/run/systemd/system" ]; then
@ -4463,11 +4518,13 @@ daemons_running() {
FAILED_DAEMONS=0
for fname in minion master syndic api; do
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
# Skip if not meant to be installed
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
#[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
# shellcheck disable=SC2009
@ -4759,10 +4816,13 @@ if [ "$DAEMONS_RUNNING_FUNC" != "null" ] && [ $_START_DAEMONS -eq $BS_TRUE ]; th
echoerror "Failed to run ${DAEMONS_RUNNING_FUNC}()!!!"
for fname in minion master syndic api; do
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
# Skip if not meant to be installed
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
#[ $fname = "api" ] && ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || [ "$(which salt-${fname} 2>/dev/null)" = "" ]) && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if [ "$_ECHO_DEBUG" -eq $BS_FALSE ]; then