Update for Salt 2016.11.3

e9
David Murphy 8 years ago
parent 2c9abf7e6b
commit 9618e807a7

1
.gitignore vendored

@ -68,3 +68,4 @@
/salt-2016.11.1.tar.gz /salt-2016.11.1.tar.gz
/salt-2016.3.5.tar.gz /salt-2016.3.5.tar.gz
/salt-2016.11.2.tar.gz /salt-2016.11.2.tar.gz
/salt-2016.11.3.tar.gz

@ -139,7 +139,7 @@ case "$1" in
RETVAL=$? RETVAL=$?
fi fi
;; ;;
condrestart) condrestart|try-restart)
[ -f $LOCKFILE ] && restart || : [ -f $LOCKFILE ] && restart || :
;; ;;
reload) reload)
@ -147,7 +147,7 @@ case "$1" in
RETVAL=1 RETVAL=1
;; ;;
*) *)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}" echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload}"
exit 1 exit 1
;; ;;
esac esac

@ -24,133 +24,301 @@
# #
# processname: /usr/bin/salt-minion # processname: /usr/bin/salt-minion
# Allow these to be overridden for tests
: "${SALTMINION_BINDIR:=/usr/bin}"
: "${SALTMINION_SYSCONFDIR:=/etc}"
DEBIAN_VERSION=/etc/debian_version # Default values (can be overridden in settings file)
SUSE_RELEASE=/etc/SuSE-release : "${USER:=$(id -nu)}"
# Source function library. SALTMINION="${SALTMINION_BINDIR}/salt-minion"
if [ -f $DEBIAN_VERSION ]; then SALTCALL="${SALTMINION_BINDIR}/salt-call"
break # SALTMINION_CONFIGS are newline-separated entries of: MINION_USER CONFIG_DIR
elif [ -f $SUSE_RELEASE -a -r /etc/rc.status ]; then : "${SALTMINION_CONFIGS:="
. /etc/rc.status $USER ${SALTMINION_SYSCONFDIR}/salt
else "}"
. /etc/rc.d/init.d/functions SALTMINION_ARGS=""
fi SALTMINION_TIMEOUT=30
SALTMINION_TICK=1
# Default values (can be overridden below) SERVICE="salt-minion"
SALTMINION=/usr/bin/salt-minion
PYTHON=/usr/bin/python
MINION_ARGS=""
if [ -f /etc/default/salt ]; then # Read in settings file
. /etc/default/salt if [ -f "${SALTMINION_SYSCONFDIR}/default/salt" ]; then
. "${SALTMINION_SYSCONFDIR}/default/salt"
elif [ -f "${SALTMINION_SYSCONFDIR}/sysconfig/salt" ]; then
. "${SALTMINION_SYSCONFDIR}/sysconfig/salt"
fi fi
SERVICE=salt-minion
PROCESS=salt-minion
RETVAL=0 RETVAL=0
NS_NOTRIM="--notrim"
ERROR_TO_DEVNULL="/dev/null"
_su_cmd() {
local user="$1"
shift
if [ "X$USER" = "X$user" ]; then
eval $1
else
su -l -c "$1" "$user"
fi
}
_get_pid() {
netstat $NS_NOTRIM -ap --protocol=unix 2>$ERROR_TO_DEVNULL \
| sed -r -e "\|\s${SOCK_DIR}/minion_event_${MINION_ID_HASH}_pub\.ipc$|"'!d; s|/.*||; s/.*\s//;' \
| uniq
}
_is_running() {
[ -n "$(_get_pid)" ]
}
_get_salt_config_value() {
_su_cmd \
"$MINION_USER" \
"\
\"$SALTCALL\" \
-c \"$CONFIG_DIR\" \
--no-color \
--local config.get \
\"$1\" \
" \
2>$ERROR_TO_DEVNULL \
| sed -r -e '2!d; s/^\s*//;'
}
_make_id_hash() {
# $1 - minion_id
local hasher=''
case "$(_get_salt_config_value hash_type)" in
(md5) hasher="md5sum";;
(sha1) hasher="sha1sum";;
(sha224) hasher="sha224sum";;
(sha256) hasher="sha256sum";;
(sha384) hasher="sha384sum";;
(sha512) hasher="sha512sum";;
(*) echo "ERROR: No salt hash_type specified";;
esac
if [ -n "$hasher" ]; then
printf "$1" | "$hasher" | cut -c 1-10
fi
}
start() { start() {
echo -n $"Starting salt-minion daemon: " # $1 - config dir
if [ -f $SUSE_RELEASE ]; then local retval=0
startproc -f -p /var/run/$SERVICE.pid $SALTMINION -d $MINION_ARGS
rc_status -v if _is_running; then
elif [ -e $DEBIAN_VERSION ]; then echo "Service $SERVICE:$MINION_USER:$MINION_ID already running"
if [ -f $LOCKFILE ]; then return 0
echo -n "already started, lock file found" fi
RETVAL=1
elif $PYTHON $SALTMINION -d $MINION_ARGS >& /dev/null; then echo -n "Starting $SERVICE:$MINION_USER:$MINION_ID daemon: "
echo -n "OK"
RETVAL=0 _su_cmd \
fi "$MINION_USER" \
"\
\"$SALTMINION\" \
-c \"$CONFIG_DIR\" \
-d $SALTMINION_ARGS \
${SALTMINION_DEBUG:+-l debug} \
" \
2>$ERROR_TO_DEVNULL \
|| retval=$?
if [ 0 -eq "$retval" ]; then
local endtime=$(($(date '+%s')+$SALTMINION_TIMEOUT))
while ! _is_running; do
if [ "$endtime" -lt "$(date '+%s')" ]; then
echo -n "TIMEOUT "
retval=1
break
fi
sleep $SALTMINION_TICK
done
fi
if [ 0 -eq "$retval" ]; then
echo -n "OK"
else else
if [[ ! -z "$(pidofproc -p /var/run/$SERVICE.pid $PROCESS)" ]]; then echo -n "FAIL"
RETVAL=$? if [ -n "$SALTMINION_DEBUG" ]; then
echo -n "already running" printf "\nPROCESSES:\n" >&2
else ps wwwaxu | grep '[s]alt-minion' >&2
daemon --check $SERVICE $SALTMINION -d $MINION_ARGS printf "\nSOCKETS:\n" >&2
RETVAL=$? netstat $NS_NOTRIM -ap --protocol=unix | grep 'salt.*minion' >&2
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SERVICE printf "\nLOG_FILE:\n" >&2
echo tail -n 20 "$LOG_FILE" >&2
return $RETVAL printf "\nENVIRONMENT:\n" >&2
env >&2
fi fi
fi fi
RETVAL=$?
echo echo
return $RETVAL
return $retval
} }
stop() { stop() {
echo -n $"Stopping salt-minion daemon: " # $1 - config dir
if [ -f $SUSE_RELEASE ]; then local retval=0
killproc -TERM $SALTMINION
rc_status -v if ! _is_running; then
RETVAL=$? echo "Service $SERVICE:$MINION_USER:$MINION_ID is not running"
elif [ -f $DEBIAN_VERSION ]; then return 0
# Added this since Debian's start-stop-daemon doesn't support spawned processes fi
if ps -ef | grep "$PYTHON $SALTMINION" | grep -v grep | awk '{print $2}' | xargs kill &> /dev/null; then
echo -n "OK" echo -n "Stopping $SERVICE:$MINION_USER:$MINION_ID daemon: "
RETVAL=0 local pid="$(_get_pid)"
else
echo -n "Daemon is not started" # pid below is intentionally not quoted in case there are *multiple*
RETVAL=1 # minions running with the same configuration.
fi _su_cmd "$MINION_USER" "kill -TERM $pid 2>/dev/null" || retval=$?
else if [ 0 -eq "$retval" ]; then
killproc $PROCESS local endtime=$(($(date '+%s')+$SALTMINION_TIMEOUT))
RETVAL=$? while _is_running; do
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$SERVICE if [ "$endtime" -lt "$(date '+%s')" ]; then
# tidy up any rogue processes: # Try one more time with a big hammer
PROCS=`ps -ef | grep "$SALTMINION" | grep -v grep | awk '{print $2}'` _su_cmd "$MINION_USER" "kill -KILL $pid 2>/dev/null" || :
if [ -n "$PROCS" ]; then sleep $SALTMINION_TICK
kill $PROCS &> /dev/null if _is_running; then
sleep 1 echo -n "TIMEOUT "
PROCS=`ps -ef | grep "$SALTMINION" | grep -v grep | awk '{print $2}'` retval=1
if [ -n "$PROCS" ]; then fi
kill -9 $PROCS &> /dev/null break
fi fi
fi sleep 1
done
fi
if [ 0 -eq "$retval" ]; then
rm -f "$PID_FILE"
echo -n "OK"
else
echo -n "FAIL"
fi fi
echo echo
return $retval
}
status() {
local retval=0
local pid="$(_get_pid)"
if [ -n "$pid" ]; then
# Unquote $pid here to display multiple PIDs in one line
echo "$SERVICE:$MINION_USER:$MINION_ID is running:" $pid
else
retval=3
echo "$SERVICE:$MINION_USER:$MINION_ID is stopped."
if [ -e "$PID_FILE" ]; then
echo "$SERVICE:$MINION_USER:$MINION_ID has orphaned pid file: $PID_FILE."
retval=1
fi
fi
return $retval
} }
restart() { restart() {
stop # $1 - config dir
start stop "$1"
start "$1"
} }
# See how we were called.
case "$1" in main() {
start|stop|restart) if [ -n "$SALTMINION_DEBUG" ]; then
$1 set -x
;; ERROR_TO_DEVNULL="&2"
status) fi
if [ -f $SUSE_RELEASE ]; then
echo -n "Checking for service salt-minion " # Check to see if --notrim is a valid netstat option
checkproc $SALTMINION if netstat --notrim 2>&1 >/dev/null | grep -q 'unrecognized'; then
rc_status -v NS_NOTRIM=''
elif [ -f $DEBIAN_VERSION ]; then fi
if [ -f $LOCKFILE ]; then
RETVAL=0 # Pre-filter for unhandled commands
echo "salt-minion is running." case "$1" in
else (start|stop|status|restart|condrestart|try-restart) ;;
RETVAL=1 (reload)
echo "salt-minion is stopped." echo "Can't reload $SERVICE - you must restart it"
fi exit 3
else ;;
status $PROCESS (*)
RETVAL=$? echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload}"
exit 2
;;
esac
while read MINION_USER CONFIG_DIR; do
if [ -z "$CONFIG_DIR" ]; then
continue
fi fi
;;
condrestart) if ! [ -d "$CONFIG_DIR" ]; then
[ -f $LOCKFILE ] && restart || : echo "ERROR: non-existent $SERVICE config directory: $CONFIG_DIR"
;; RETVAL=1
reload) continue
echo "can't reload configuration, you have to restart it" fi
RETVAL=1
;; SOCK_DIR="$(_get_salt_config_value sock_dir)"
*) PID_FILE="$(_get_salt_config_value pidfile)"
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}" LOG_FILE="$(_get_salt_config_value log_file)"
exit 1 MINION_ID="$(_get_salt_config_value id)"
;; MINION_ID_HASH="$(_make_id_hash "$MINION_ID")"
esac if [ \
exit $RETVAL -z "$SOCK_DIR" \
-o -z "$PID_FILE" \
-o -z "$LOG_FILE" \
-o -z "$MINION_ID" \
-o -z "$MINION_ID_HASH" \
]; then
echo "ERROR: Unable to look-up config values for $CONFIG_DIR"
RETVAL=1
continue
fi
# See how we were called.
case "$1" in
(start|stop|restart|status)
"$1" || RETVAL=$?
;;
(condrestart|try-restart)
if ! _is_running; then
RETVAL=7
else
stop
start || RETVAL=$?
fi
;;
(*)
echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload}"
RETVAL=2
;;
esac
done <<EOF
$SALTMINION_CONFIGS
EOF
exit $RETVAL
}
if [ "$#" = 0 ]; then
main
else
main "$@"
fi

@ -35,8 +35,8 @@
%define _salttesting_ver 2016.10.26 %define _salttesting_ver 2016.10.26
Name: salt Name: salt
Version: 2016.11.2 Version: 2016.11.3
Release: 2%{?dist} Release: 1%{?dist}
Summary: A parallel remote execution system Summary: A parallel remote execution system
Group: System Environment/Daemons Group: System Environment/Daemons
@ -375,7 +375,6 @@ rm -rf %{buildroot}
%config(noreplace) %{_sysconfdir}/salt/master %config(noreplace) %{_sysconfdir}/salt/master
%config(noreplace) %{_sysconfdir}/salt/master.d %config(noreplace) %{_sysconfdir}/salt/master.d
%config(noreplace) %{_sysconfdir}/salt/pki/master %config(noreplace) %{_sysconfdir}/salt/pki/master
%config(noreplace) %{_var}/log/salt/master
%files minion %files minion
%defattr(-,root,root) %defattr(-,root,root)
@ -394,7 +393,6 @@ rm -rf %{buildroot}
%config(noreplace) %{_sysconfdir}/salt/proxy %config(noreplace) %{_sysconfdir}/salt/proxy
%config(noreplace) %{_sysconfdir}/salt/minion.d %config(noreplace) %{_sysconfdir}/salt/minion.d
%config(noreplace) %{_sysconfdir}/salt/pki/minion %config(noreplace) %{_sysconfdir}/salt/pki/minion
%config(noreplace) %{_var}/log/salt/minion
%files syndic %files syndic
%doc %{_mandir}/man1/salt-syndic.1* %doc %{_mandir}/man1/salt-syndic.1*
@ -558,6 +556,9 @@ rm -rf %{buildroot}
%endif %endif
%changelog %changelog
* Wed Feb 22 2017 SaltStack Packaging Team <packaging@saltstack.com> - 2016.11.3-1
- Update to feature release 2016.11.3
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2016.11.2-2 * Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2016.11.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

@ -1,2 +1,2 @@
SHA512 (salt-2016.11.2.tar.gz) = 0dbc861424643af664edd2d9cb8bcbde7e9bcf7c1d202a5e844af83c21dc2d75fd7034db27dffc58dc2a6e47cfe2ea2c42e2a9af867c7ca78f93166eb4fd03ad SHA512 (salt-2016.11.3.tar.gz) = 24bc75c50b4d6bd38a6f2dedc0a8c12142cc1b9d551455e49ea0ede405c78eb6a939f741dd8c0cbb8f206937ee69582bebe2fc127a24a4c2cf06cf3c3c16e507
SHA512 (SaltTesting-2016.10.26.tar.gz) = 0817d3738992bb1e89728a9cd939056bc919de9c995445aac8820f895204e0f14df4cff989c46456b382180e3a1685827a113dbb609518e88c6b944f9222698a SHA512 (SaltTesting-2016.10.26.tar.gz) = 0817d3738992bb1e89728a9cd939056bc919de9c995445aac8820f895204e0f14df4cff989c46456b382180e3a1685827a113dbb609518e88c6b944f9222698a

Loading…
Cancel
Save