diff --git a/.gitignore b/.gitignore index ab45fea..10ffaca 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,4 @@ /SaltTesting-2014.8.5.tar.gz /salt-2014.1.11.tar.gz /salt-2014.1.13.tar.gz +/salt-2014.7.0.tar.gz diff --git a/salt-api b/salt-api new file mode 100644 index 0000000..e4dfc3e --- /dev/null +++ b/salt-api @@ -0,0 +1,146 @@ +#!/bin/sh +# +# Salt API +################################### + +# LSB header + +### BEGIN INIT INFO +# Provides: salt-api +# Required-Start: $local_fs $remote_fs $network $named $time +# Should-Start: $time ypbind smtp +# Required-Stop: $local_fs $remote_fs $network $named $time +# Should-Stop: ypbind smtp +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Salt API control daemon +# Description: This is a daemon that controls the Salt API. +### END INIT INFO + + +# chkconfig header + +# chkconfig: 345 99 99 +# description: This is a daemon that controls the Salt API. +# +# processname: /usr/bin/salt-api + + +if [ -f /etc/default/salt ]; then + . /etc/default/salt +else + SALTAPI=/usr/bin/salt-api + PYTHON=/usr/bin/python +fi + +# Sanity checks. +[ -x $SALTAPI ] || exit 0 + +DEBIAN_VERSION=/etc/debian_version +SUSE_RELEASE=/etc/SuSE-release +# Source function library. +if [ -f $DEBIAN_VERSION ]; then + break +elif [ -f $SUSE_RELEASE -a -r /etc/rc.status ]; then + . /etc/rc.status +else + . /etc/rc.d/init.d/functions +fi + +SERVICE=salt-api +PROCESS=salt-api +CONFIG_ARGS="-d" +PID_FILE="/var/run/salt-api.pid" + +RETVAL=0 + +start() { + echo -n $"Starting salt-api daemon: " + if [ -f $SUSE_RELEASE ]; then + startproc -f -p /var/run/$SERVICE.pid $SALTAPI $CONFIG_ARGS + rc_status -v + elif [ -e $DEBIAN_VERSION ]; then + if [ -f $LOCKFILE ]; then + echo -n "already started, lock file found" + RETVAL=1 + elif $PYTHON $SALTAPI; then + echo -n "OK" + RETVAL=0 + fi + else + if status $PROCESS &> /dev/null; then + failure "Already running." + RETVAL=1 + else + daemon --pidfile=$PID_FILE --check $SERVICE $SALTAPI $CONFIG_ARGS + RETVAL=0 + fi + fi + RETVAL=$? + echo + return $RETVAL +} + +stop() { + echo -n $"Stopping salt-api daemon: " + if [ -f $SUSE_RELEASE ]; then + killproc -TERM $SALTAPI + rc_status -v + elif [ -f $DEBIAN_VERSION ]; then + # Added this since Debian's start-stop-daemon doesn't support spawned processes + if ps -ef | grep "$PYTHON $SALTAPI" | grep -v grep | awk '{print $2}' | xargs kill &> /dev/null; then + echo -n "OK" + RETVAL=0 + else + echo -n "Daemon is not started" + RETVAL=1 + fi + else + killproc $PROCESS + fi + RETVAL=$? + echo + return $RETVAL +} + +restart() { + stop + start +} + +# See how we were called. +case "$1" in + start|stop|restart) + $1 + ;; + status) + if [ -f $SUSE_RELEASE ]; then + echo -n "Checking for service salt-api " + checkproc $SALTAPI + rc_status -v + elif [ -f $DEBIAN_VERSION ]; then + if [ -f $LOCKFILE ]; then + RETVAL=0 + echo "salt-api is running." + else + RETVAL=1 + echo "salt-api is stopped." + fi + else + status $PROCESS + RETVAL=$? + fi + ;; + condrestart) + [ -f $LOCKFILE ] && restart || : + ;; + reload) + echo "can't reload configuration, you have to restart it" + RETVAL=$? + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}" + exit 1 + ;; +esac +exit $RETVAL diff --git a/salt-api.service b/salt-api.service new file mode 100644 index 0000000..7419808 --- /dev/null +++ b/salt-api.service @@ -0,0 +1,10 @@ +[Unit] +Description=The Salt API +After=syslog.target network.target + +[Service] +Type=simple +ExecStart=/usr/bin/salt-api + +[Install] +WantedBy=multi-user.target diff --git a/salt.spec b/salt.spec index 7a100e5..1f31104 100644 --- a/salt.spec +++ b/salt.spec @@ -5,7 +5,7 @@ %define __python %{_bindir}/python%{?pybasever} %endif -%global include_tests 1 +%global include_tests 0 %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} @@ -15,7 +15,7 @@ %define _salttesting_ver 2014.8.5 Name: salt -Version: 2014.1.13 +Version: 2014.7.0 Release: 1%{?dist} Summary: A parallel remote execution system @@ -27,11 +27,13 @@ Source1: https://pypi.python.org/packages/source/S/%{_salttesting}/%{_salttestin Source2: %{name}-master Source3: %{name}-syndic Source4: %{name}-minion -Source5: %{name}-master.service -Source6: %{name}-syndic.service -Source7: %{name}-minion.service -Source8: README.fedora -Source9: logrotate.salt +Source5: %{name}-api +Source6: %{name}-master.service +Source7: %{name}-syndic.service +Source8: %{name}-minion.service +Source9: %{name}-api.service +Source10: README.fedora +Source11: logrotate.salt BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch @@ -45,49 +47,45 @@ Requires: yum-utils Requires: sshpass %if 0%{?with_python26} -BuildRequires: python26-crypto -BuildRequires: python26-devel -BuildRequires: python26-jinja2 -BuildRequires: python26-m2crypto -BuildRequires: python26-msgpack -BuildRequires: python26-zmq -BuildRequires: python26-PyYAML +BuildRequires: python26-devel Requires: python26-crypto Requires: python26-jinja2 Requires: python26-m2crypto Requires: python26-msgpack Requires: python26-PyYAML +Requires: python26-requests Requires: python26-zmq %else %if ((0%{?rhel} >= 6 || 0%{?fedora} > 12) && 0%{?include_tests}) +BuildRequires: m2crypto +BuildRequires: python-crypto +BuildRequires: python-jinja2 +BuildRequires: python-msgpack +BuildRequires: python-pip +BuildRequires: python-zmq +BuildRequires: PyYAML +BuildRequires: python-requests BuildRequires: python-unittest2 # this BR causes windows tests to happen # clearly, that's not desired # https://github.com/saltstack/salt/issues/3749 BuildRequires: python-mock BuildRequires: git +BuildRequires: python-libcloud -Requires: python-libcloud %endif -BuildRequires: m2crypto -BuildRequires: python-crypto BuildRequires: python-devel -BuildRequires: python-jinja2 -BuildRequires: python-msgpack -BuildRequires: python-pip -BuildRequires: python-zmq -BuildRequires: PyYAML - +Requires: m2crypto Requires: python-crypto -Requires: python-zmq Requires: python-jinja2 -Requires: PyYAML -Requires: m2crypto Requires: python-msgpack +Requires: PyYAML +Requires: python-requests +Requires: python-zmq %endif @@ -121,24 +119,53 @@ malleable. Salt accomplishes this via its ability to handle larger loads of information, and not just dozens, but hundreds or even thousands of individual servers, handle them quickly and through a simple and manageable interface. -%package -n salt-master +%package master Summary: Management component for salt, a parallel remote execution system Group: System Environment/Daemons -Requires: salt = %{version}-%{release} +Requires: %{name} = %{version}-%{release} %if (0%{?rhel} >= 7 || 0%{?fedora} >= 15) Requires: systemd-python %endif -%description -n salt-master +%description master The Salt master is the central server to which all minions connect. -%package -n salt-minion -Summary: Client component for salt, a parallel remote execution system +%package minion +Summary: Client component for Salt, a parallel remote execution system Group: System Environment/Daemons -Requires: salt = %{version}-%{release} +Requires: %{name} = %{version}-%{release} + +%description minion +The Salt minion is the agent component of Salt. It listens for instructions +from the master, runs jobs, and returns results back to the master. -%description -n salt-minion -Salt minion is queried and controlled from the master. +%package syndic +Summary: Master-of-master component for Salt, a parallel remote execution system +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} + +%description syndic +The Salt syndic is a master daemon which can receive instruction from a +higher-level master, allowing for tiered organization of your Salt +infrastructure. + +%package cloud +Summary: Cloud provisioner for Salt, a parallel remote execution system +Group: System administration tools +Requires: %{name}-master = %{version}-%{release} + +%description cloud +The salt-cloud tool provisions new cloud VMs, installs salt-minion on them, and +adds them to the master's collection of controllable minions. + +%package ssh +Summary: Agentless SSH-based version of Salt, a parallel remote execution system +Group: System administration tools +Requires: %{name} = %{version}-%{release} + +%description ssh +The salt-ssh tool can run remote execution functions and states without the use +of an agent (salt-minion) service. %prep %setup -c @@ -152,31 +179,43 @@ rm -rf %{buildroot} cd $RPM_BUILD_DIR/%{name}-%{version}/%{name}-%{version} %{__python} setup.py install -O1 --root %{buildroot} +# Add some directories install -d -m 0755 %{buildroot}%{_var}/cache/salt +install -d -m 0755 %{buildroot}%{_sysconfdir}/salt +install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/cloud.conf.d +install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/cloud.deploy.d +install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/cloud.maps.d +install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/cloud.profiles.d +install -d -m 0755 %{buildroot}%{_sysconfdir}/salt/cloud.providers.d + +# Add the config files +install -p -m 0640 conf/minion %{buildroot}%{_sysconfdir}/salt/minion +install -p -m 0640 conf/master %{buildroot}%{_sysconfdir}/salt/master +install -p -m 0640 conf/cloud %{buildroot}%{_sysconfdir}/salt/cloud +install -p -m 0640 conf/roster %{buildroot}%{_sysconfdir}/salt/roster %if ! (0%{?rhel} >= 7 || 0%{?fedora} >= 15) mkdir -p %{buildroot}%{_initrddir} install -p %{SOURCE2} %{buildroot}%{_initrddir}/ install -p %{SOURCE3} %{buildroot}%{_initrddir}/ install -p %{SOURCE4} %{buildroot}%{_initrddir}/ +install -p %{SOURCE5} %{buildroot}%{_initrddir}/ %else mkdir -p %{buildroot}%{_unitdir} -install -p -m 0644 %{SOURCE5} %{buildroot}%{_unitdir}/ install -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ install -p -m 0644 %{SOURCE7} %{buildroot}%{_unitdir}/ +install -p -m 0644 %{SOURCE8} %{buildroot}%{_unitdir}/ +install -p -m 0644 %{SOURCE9} %{buildroot}%{_unitdir}/ %endif -install -p %{SOURCE8} . +install -p %{SOURCE10} . mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d/ -install -p %{SOURCE9} %{buildroot}%{_sysconfdir}/logrotate.d/salt - -mkdir -p %{buildroot}%{_sysconfdir}/salt/ -install -p -m 0640 conf/minion %{buildroot}%{_sysconfdir}/salt/minion -install -p -m 0640 conf/master %{buildroot}%{_sysconfdir}/salt/master +install -p %{SOURCE11} %{buildroot}%{_sysconfdir}/logrotate.d/salt %if ((0%{?rhel} >= 6 || 0%{?fedora} > 12) && 0%{?include_tests}) %check cd $RPM_BUILD_DIR/%{name}-%{version}/%{name}-%{version} +mkdir %{_tmppath}/salt-test-cache PYTHONPATH=%{pythonpath}:$RPM_BUILD_DIR/%{name}-%{version}/%{_salttesting}-%{_salttesting_ver} %{__python} setup.py test --runtests-opts=-u %endif @@ -187,93 +226,122 @@ rm -rf %{buildroot} %defattr(-,root,root,-) %doc $RPM_BUILD_DIR/%{name}-%{version}/%{name}-%{version}/LICENSE %{python_sitelib}/%{name}/* -%{python_sitelib}/%{name}-%{version}-py?.?.egg-info +#%{python_sitelib}/%{name}-%{version}-py?.?.egg-info +%{python_sitelib}/%{name}-*-py?.?.egg-info %{_sysconfdir}/logrotate.d/salt %{_var}/cache/salt %doc %{_mandir}/man7/salt.7.* %doc $RPM_BUILD_DIR/%{name}-%{version}/%{name}-%{version}/README.fedora -%files -n salt-minion +%files master +%defattr(-,root,root) +%doc %{_mandir}/man1/salt.1.* +%doc %{_mandir}/man1/salt-api.1.* +%doc %{_mandir}/man1/salt-cp.1.* +%doc %{_mandir}/man1/salt-key.1.* +%doc %{_mandir}/man1/salt-master.1.* +%doc %{_mandir}/man1/salt-run.1.* +%doc %{_mandir}/man1/salt-unity.1.* +%{_bindir}/salt +%{_bindir}/salt-api +%{_bindir}/salt-cp +%{_bindir}/salt-key +%{_bindir}/salt-master +%{_bindir}/salt-run +%{_bindir}/salt-unity +%if ! (0%{?rhel} >= 7 || 0%{?fedora} >= 15) +%attr(0755, root, root) %{_initrddir}/salt-api +%attr(0755, root, root) %{_initrddir}/salt-master +%else +%{_unitdir}/salt-api.service +%{_unitdir}/salt-master.service +%endif +%config(noreplace) %{_sysconfdir}/salt/master + +%files minion %defattr(-,root,root) %doc %{_mandir}/man1/salt-call.1.* %doc %{_mandir}/man1/salt-minion.1.* %{_bindir}/salt-minion %{_bindir}/salt-call - %if ! (0%{?rhel} >= 7 || 0%{?fedora} >= 15) %attr(0755, root, root) %{_initrddir}/salt-minion %else %{_unitdir}/salt-minion.service %endif - %config(noreplace) %{_sysconfdir}/salt/minion -%files -n salt-master -%defattr(-,root,root) -%doc %{_mandir}/man1/salt.1.* -%doc %{_mandir}/man1/salt-cloud.1.* -%doc %{_mandir}/man1/salt-cp.1.* -%doc %{_mandir}/man1/salt-key.1.* -%doc %{_mandir}/man1/salt-master.1.* -%doc %{_mandir}/man1/salt-run.1.* -%doc %{_mandir}/man1/salt-ssh.1.* +%files syndic %doc %{_mandir}/man1/salt-syndic.1.* -%{_bindir}/salt -%{_bindir}/salt-cloud -%{_bindir}/salt-cp -%{_bindir}/salt-key -%{_bindir}/salt-master -%{_bindir}/salt-run -%{_bindir}/salt-ssh %{_bindir}/salt-syndic %if ! (0%{?rhel} >= 7 || 0%{?fedora} >= 15) -%attr(0755, root, root) %{_initrddir}/salt-master %attr(0755, root, root) %{_initrddir}/salt-syndic %else -%{_unitdir}/salt-master.service %{_unitdir}/salt-syndic.service %endif -%config(noreplace) %{_sysconfdir}/salt/master + +%files cloud +%doc %{_mandir}/man1/salt-cloud.1.* +%{_bindir}/salt-cloud +%{_sysconfdir}/salt/cloud.conf.d +%{_sysconfdir}/salt/cloud.deploy.d +%{_sysconfdir}/salt/cloud.maps.d +%{_sysconfdir}/salt/cloud.profiles.d +%{_sysconfdir}/salt/cloud.providers.d +%config(noreplace) %{_sysconfdir}/salt/cloud + +%files ssh +%doc %{_mandir}/man1/salt-ssh.1.* +%{_bindir}/salt-ssh +%{_sysconfdir}/salt/roster + # less than RHEL 8 / Fedora 16 # not sure if RHEL 7 will use systemd yet %if ! (0%{?rhel} >= 7 || 0%{?fedora} >= 15) -%preun -n salt-master +%preun master if [ $1 -eq 0 ] ; then /sbin/service salt-master stop >/dev/null 2>&1 - /sbin/service salt-syndic stop >/dev/null 2>&1 /sbin/chkconfig --del salt-master + fi + +%preun syndic + if [ $1 -eq 0 ] ; then + /sbin/service salt-syndic stop >/dev/null 2>&1 /sbin/chkconfig --del salt-syndic fi -%preun -n salt-minion +%preun minion if [ $1 -eq 0 ] ; then /sbin/service salt-minion stop >/dev/null 2>&1 /sbin/chkconfig --del salt-minion fi -%post -n salt-master +%post master /sbin/chkconfig --add salt-master - /sbin/chkconfig --add salt-syndic -%post -n salt-minion +%post minion /sbin/chkconfig --add salt-minion -%postun -n salt-master +%postun master if [ "$1" -ge "1" ] ; then /sbin/service salt-master condrestart >/dev/null 2>&1 || : - /sbin/service salt-syndic condrestart >/dev/null 2>&1 || : fi -%postun -n salt-minion +#%postun syndic +# if [ "$1" -ge "1" ] ; then +# /sbin/service salt-syndic condrestart >/dev/null 2>&1 || : +# fi + +%postun minion if [ "$1" -ge "1" ] ; then /sbin/service salt-minion condrestart >/dev/null 2>&1 || : fi %else -%preun -n salt-master +%preun master %if 0%{?systemd_preun:1} %systemd_preun salt-master.service %else @@ -281,47 +349,62 @@ rm -rf %{buildroot} # Package removal, not upgrade /bin/systemctl --no-reload disable salt-master.service > /dev/null 2>&1 || : /bin/systemctl stop salt-master.service > /dev/null 2>&1 || : + fi +%endif +%preun syndic +%if 0%{?systemd_preun:1} + %systemd_preun salt-syndic.service +%else + if [ $1 -eq 0 ] ; then + # Package removal, not upgrade /bin/systemctl --no-reload disable salt-syndic.service > /dev/null 2>&1 || : /bin/systemctl stop salt-syndic.service > /dev/null 2>&1 || : fi %endif -%preun -n salt-minion +%preun minion %if 0%{?systemd_preun:1} %systemd_preun salt-minion.service %else if [ $1 -eq 0 ] ; then - # Package removal, not upgrade - /bin/systemctl --no-reload disable salt-minion.service > /dev/null 2>&1 || : - /bin/systemctl stop salt-minion.service > /dev/null 2>&1 || : + # Package removal, not upgrade + /bin/systemctl --no-reload disable salt-minion.service > /dev/null 2>&1 || : + /bin/systemctl stop salt-minion.service > /dev/null 2>&1 || : fi %endif -%post -n salt-master +%post master %if 0%{?systemd_post:1} %systemd_post salt-master.service %else /bin/systemctl daemon-reload &>/dev/null || : %endif -%post -n salt-minion +%post minion %if 0%{?systemd_post:1} %systemd_post salt-minion.service %else /bin/systemctl daemon-reload &>/dev/null || : %endif -%postun -n salt-master +%postun master %if 0%{?systemd_post:1} %systemd_postun salt-master.service %else /bin/systemctl daemon-reload &>/dev/null [ $1 -gt 0 ] && /bin/systemctl try-restart salt-master.service &>/dev/null || : +%endif + +%postun syndic +%if 0%{?systemd_post:1} + %systemd_postun salt-syndic.service +%else + /bin/systemctl daemon-reload &>/dev/null [ $1 -gt 0 ] && /bin/systemctl try-restart salt-syndic.service &>/dev/null || : %endif -%postun -n salt-minion +%postun minion %if 0%{?systemd_post:1} %systemd_postun salt-minion.service %else @@ -332,6 +415,9 @@ rm -rf %{buildroot} %endif %changelog +* Thu Nov 6 2014 Erik Johnson - 2014.7.0-1 +- Update to feature release 2014.7.0 + * Fri Oct 17 2014 Erik Johnson - 2014.1.13-1 - Update to bugfix release 2014.1.13 diff --git a/sources b/sources index 3c10aa4..426f553 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -b5088ddc04ddee7f8561aa77f4d36c6e salt-2014.1.13.tar.gz +3bbb6194f9146a5efad8963c9340d4cd salt-2014.7.0.tar.gz 98fde1446d85ad42eaf2949871037b87 SaltTesting-2014.8.5.tar.gz