diff --git a/.gitignore b/.gitignore index e69de29..4537aa2 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/salt-0.9.4.tar.gz diff --git a/README.fedora b/README.fedora new file mode 100644 index 0000000..c9c9dd5 --- /dev/null +++ b/README.fedora @@ -0,0 +1,7 @@ +These packages are *optional* dependencies for salt. By default, they are not included in the salt RPMs. +Feel free to yum install any of these packages. + +MySQL-python +libvirt-python +yum + diff --git a/salt-master b/salt-master new file mode 100644 index 0000000..3e47ccb --- /dev/null +++ b/salt-master @@ -0,0 +1,125 @@ +#!/bin/sh +# +# Salt master +################################### + +# LSB header + +### BEGIN INIT INFO +# Description: This is a daemon that controls the salt minions +# Provides: salt-master +# Required-Start: network +# Short-Description: salt master control daemon +### END INIT INFO + +# chkconfig header + +# chkconfig: 345 99 99 +# description: This is a daemon that controls the salt minions +# +# processname: /usr/bin/salt-master + +# Sanity checks. +[ -x /usr/bin/salt-master ] || 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-master +PROCESS=salt-master +CONFIG_ARGS=" " + +RETVAL=0 + +start() { + echo -n $"Starting salt-master daemon: " + if [ -f $SUSE_RELEASE ]; then + startproc -f -p /var/run/$SERVICE.pid /usr/bin/salt-master -d $CONFIG_ARGS + rc_status -v + elif [ -e $DEBIAN_VERSION ]; then + if [ -f $LOCKFILE ]; then + echo -n "already started, lock file found" + RETVAL=1 + elif /usr/bin/python /usr/bin/salt-master -d; then + echo -n "OK" + RETVAL=0 + fi + else + daemon --check $SERVICE $PROCESS -d $CONFIG_ARGS + fi + RETVAL=$? + echo + return $RETVAL +} + +stop() { + echo -n $"Stopping salt-master daemon: " + if [ -f $SUSE_RELEASE ]; then + killproc -TERM /usr/bin/salt-master + 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 "/usr/bin/python /usr/bin/salt-master" | 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 +} + +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-master " + checkproc /usr/bin/salt-master + rc_status -v + elif [ -f $DEBIAN_VERSION ]; then + if [ -f $LOCKFILE ]; then + RETVAL=0 + echo "salt-master is running." + else + RETVAL=1 + echo "salt-master 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-master.service b/salt-master.service new file mode 100644 index 0000000..4f3827e --- /dev/null +++ b/salt-master.service @@ -0,0 +1,10 @@ +[Unit] +Description=The Salt Master Server +After=syslog.target network.target + +[Service] +Type=simple +ExecStart=/usr/bin/salt-master + +[Install] +WantedBy=multi-user.target diff --git a/salt-minion b/salt-minion new file mode 100644 index 0000000..399c840 --- /dev/null +++ b/salt-minion @@ -0,0 +1,125 @@ +#!/bin/sh +# +# Salt minion +################################### + +# LSB header + +### BEGIN INIT INFO +# Provides: salt-minion +# Required-Start: network +# Short-Description: salt minion control daemon +# Description: This is a daemon that controls the salt minions +### END INIT INFO + +# chkconfig header + +# chkconfig: 345 99 99 +# description: This is a daemon that controls the salt mininons +# +# processname: /usr/bin/salt-minion + +# Sanity checks. +[ -x /usr/bin/salt-minion ] || 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-minion +PROCESS=salt-minion +CONFIG_ARGS=" " + +RETVAL=0 + +start() { + echo -n $"Starting salt-minion daemon: " + if [ -f $SUSE_RELEASE ]; then + startproc -f -p /var/run/$SERVICE.pid /usr/bin/salt-minion -d $CONFIG_ARGS + rc_status -v + elif [ -e $DEBIAN_VERSION ]; then + if [ -f $LOCKFILE ]; then + echo -n "already started, lock file found" + RETVAL=1 + elif /usr/bin/python /usr/bin/salt-minion -d; then + echo -n "OK" + RETVAL=0 + fi + else + daemon --check $SERVICE $PROCESS -d $CONFIG_ARGS + fi + RETVAL=$? + echo + return $RETVAL +} + +stop() { + echo -n $"Stopping salt-minion daemon: " + if [ -f $SUSE_RELEASE ]; then + killproc -TERM /usr/bin/salt-minion + 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 "/usr/bin/python /usr/bin/salt-minion" | 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 +} + +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-minion " + checkproc /usr/bin/salt-minion + rc_status -v + elif [ -f $DEBIAN_VERSION ]; then + if [ -f $LOCKFILE ]; then + RETVAL=0 + echo "salt-minion is running." + else + RETVAL=1 + echo "salt-minion 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-minion.service b/salt-minion.service new file mode 100644 index 0000000..2f199f9 --- /dev/null +++ b/salt-minion.service @@ -0,0 +1,10 @@ +[Unit] +Description=The Salt Minion +After=syslog.target network.target + +[Service] +Type=simple +ExecStart=/usr/bin/salt-minion + +[Install] +WantedBy=multi-user.target diff --git a/salt-syndic b/salt-syndic new file mode 100644 index 0000000..44a4a8d --- /dev/null +++ b/salt-syndic @@ -0,0 +1,118 @@ +#!/bin/sh +# +# Salt syndic +################################### + +# LSB header + +### BEGIN INIT INFO +# Provides: salt-syndic +# Required-Start: network +# Short-Description: salt syndic master-minion passthrough daemon +# Description: This is a daemon that controls the salt syndic +### END INIT INFO + +# chkconfig header + +# chkconfig: 345 99 99 +# description: This is a daemon that controls the salt mininons +# +# processname: /usr/bin/salt-syndic + +# Sanity checks. +[ -x /usr/bin/salt-syndic ] || 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-syndic +PROCESS=salt-syndic +CONFIG_ARGS=" " + +RETVAL=0 + +start() { + echo -n $"Starting salt-syndic daemon: " + if [ -f $SUSE_RELEASE ]; then + startproc -f -p /var/run/$SERVICE.pid /usr/bin/salt-syndic -d $CONFIG_ARGS + rc_status -v + elif [ -e $DEBIAN_VERSION ]; then + if [ -f $LOCKFILE ]; then + echo -n "already started, lock file found" + RETVAL=1 + elif /usr/bin/python /usr/bin/salt-syndic -d; then + echo -n "OK" + RETVAL=0 + fi + else + daemon --check $SERVICE $PROCESS -d $CONFIG_ARGS + fi + RETVAL=$? + echo + return $RETVAL +} + +stop() { + echo -n $"Stopping salt-syndic daemon: " + if [ -f $SUSE_RELEASE ]; then + killproc -TERM /usr/bin/salt-syndic + 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 "/usr/bin/python /usr/bin/salt-syndic" | 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 +} + +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-syndic " + checkproc /usr/bin/salt-syndic + rc_status -v + elif [ -f $DEBIAN_VERSION ]; then + if [ -f $LOCKFILE ]; then + RETVAL=0 + echo "salt-syndic is running." + else + RETVAL=1 + echo "salt-syndic is stopped." + fi + else + status $PROCESS + RETVAL=$? + fi + ;; + *) + echo $"Usage: $0 {start|stop|status|restart}" + exit 1 + ;; +esac +exit $RETVAL + diff --git a/salt-syndic.service b/salt-syndic.service new file mode 100644 index 0000000..922eef3 --- /dev/null +++ b/salt-syndic.service @@ -0,0 +1,10 @@ +[Unit] +Description=The Salt Master Server +After=syslog.target network.target + +[Service] +Type=simple +ExecStart=/usr/bin/salt-syndic + +[Install] +WantedBy=multi-user.target diff --git a/salt.spec b/salt.spec new file mode 100644 index 0000000..ba53da1 --- /dev/null +++ b/salt.spec @@ -0,0 +1,278 @@ +%if ! (0%{?rhel} >= 6 || 0%{?fedora} > 12) +%global with_python26 1 +%define pybasever 2.6 +%define __python_ver 26 +%define __python %{_bindir}/python%{?pybasever} +%endif + +%{!?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))")} + +Name: salt +Version: 0.9.4 +Release: 7%{?dist} +Summary: A parallel remote execution system + +Group: System Environment/Daemons +License: ASL 2.0 +URL: http://saltstack.org/ +Source0: https://github.com/downloads/saltstack/%{name}/%{name}-%{version}.tar.gz +Source1: %{name}-master +Source2: %{name}-syndic +Source3: %{name}-minion +Source4: %{name}-master.service +Source5: %{name}-syndic.service +Source6: %{name}-minion.service +Source7: README.fedora +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildArch: noarch + +%if 0%{?with_python26} +BuildRequires: python26-zmq +BuildRequires: python26-crypto +BuildRequires: python26-devel +BuildRequires: python26-PyYAML +BuildRequires: python26-m2crypto + +Requires: python26-crypto +Requires: python26-zmq +Requires: python26-jinja2 +Requires: python26-PyYAML +Requires: python26-m2crypto +Requires: python26-PyXML + +%else + +BuildRequires: python-zmq +BuildRequires: python-crypto +BuildRequires: python-devel +BuildRequires: PyYAML +BuildRequires: m2crypto + +Requires: python-crypto +Requires: python-zmq +Requires: python-jinja2 +Requires: PyYAML +Requires: m2crypto +Requires: PyXML + +%endif + +%if ! (0%{?rhel} >= 7 || 0%{?fedora} >= 15) + +Requires(post): chkconfig +Requires(preun): chkconfig +Requires(preun): initscripts +Requires(postun): initscripts + +%else + +BuildRequires: systemd-units + +%endif + +# These packages are *optional* dependencies and not required. +#Requires: MySQL-python libvirt-python yum + +%description +Salt is a distributed remote execution system used to execute commands and +query data. It was developed in order to bring the best solutions found in +the world of remote execution together and make them better, faster and more +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 +Summary: Management component for salt, a parallel remote execution system +Group: System Environment/Daemons +Requires: salt = %{version}-%{release} + +%description -n salt-master +The Salt master is the central server to which all minions connect. +Summary: + +%package -n salt-minion +Summary: Client component for salt, a parallel remote execution system +Group: System Environment/Daemons +Requires: salt = %{version}-%{release} + +%description -n salt-minion +Salt minion is queried and controlled from the master. + +%prep +%setup -q + +%build + + +%install +rm -rf $RPM_BUILD_ROOT +%{__python} setup.py install -O1 --root $RPM_BUILD_ROOT + +install -p %{SOURCE7} . + +%if ! (0%{?rhel} >= 7 || 0%{?fedora} >= 15) +mkdir -p $RPM_BUILD_ROOT%{_initrddir} +install -p %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/ +install -p %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/ +install -p %{SOURCE3} $RPM_BUILD_ROOT%{_initrddir}/ +%else +mkdir -p $RPM_BUILD_ROOT%{_unitdir} +install -p -m 0644 %{SOURCE4} $RPM_BUILD_ROOT%{_unitdir}/ +install -p -m 0644 %{SOURCE5} $RPM_BUILD_ROOT%{_unitdir}/ +install -p -m 0644 %{SOURCE6} $RPM_BUILD_ROOT%{_unitdir}/ +%endif + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%doc LICENSE +%{python_sitelib}/%{name}/* +%{python_sitelib}/%{name}-%{version}-py?.?.egg-info +%doc %{_mandir}/man7/salt.7.* +%doc README.fedora + +%files -n salt-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) /etc/salt/minion + +%files -n salt-master +%defattr(-,root,root) +%doc %{_mandir}/man1/salt-master.1.* +%doc %{_mandir}/man1/salt.1.* +%doc %{_mandir}/man1/salt-cp.1.* +%doc %{_mandir}/man1/salt-key.1.* +%doc %{_mandir}/man1/salt-run.1.* +%doc %{_mandir}/man1/salt-syndic.1.* +%{_bindir}/salt +%{_bindir}/salt-master +%{_bindir}/salt-syndic +%{_bindir}/salt-cp +%{_bindir}/salt-key +%{_bindir}/salt-run +%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) /etc/salt/master + +%if ! (0%{?rhel} >= 7 || 0%{?fedora} >= 15) + +%preun -n salt-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 + /sbin/chkconfig --del salt-syndic +fi + +%preun -n salt-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 +/sbin/chkconfig --add salt-master +/sbin/chkconfig --add salt-syndic + +%post -n salt-minion +/sbin/chkconfig --add salt-minion + +%postun -n salt-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 +if [ "$1" -ge "1" ] ; then + /sbin/service salt-master condrestart >/dev/null 2>&1 || : + /sbin/service salt-syndic condrestart >/dev/null 2>&1 || : +fi + +%else + +%preun -n salt-master +if [ $1 -eq 0 ] ; then + # 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 || : + + /bin/systemctl --no-reload disable salt-syndic.service > /dev/null 2>&1 || : + /bin/systemctl stop salt-syndic.service > /dev/null 2>&1 || : +fi + +%preun -n salt-minion +if [ $1 -eq 0 ] ; then + # 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 + +%post -n salt-master +/bin/systemctl daemon-reload &>/dev/null || : + +%post -n salt-minion +/bin/systemctl daemon-reload &>/dev/null || : + +%postun -n salt-master +/bin/systemctl daemon-reload &>/dev/null +[ $1 -gt 0 ] && /bin/systemctl try-restart salt-master.service &>/dev/null || : +[ $1 -gt 0 ] && /bin/systemctl try-restart salt-syndic.service &>/dev/null || : + +%postun -n salt-minion +/bin/systemctl daemon-reload &>/dev/null +[ $1 -gt 0 ] && /bin/systemctl try-restart salt-master.service &>/dev/null || : +[ $1 -gt 0 ] && /bin/systemctl try-restart salt-syndic.service &>/dev/null || : + +%endif + +%changelog +* Sun Jan 15 2012 Clint Savage - 0.9.4-7 +- Removed optional requires from RPM and documented in added README.fedora + +* Sun Jan 8 2012 Clint Savage - 0.9.4-6 +- Missed some critical elements for SysV and rpmlint cleanup + +* Sun Jan 8 2012 Clint Savage - 0.9.4-5 +- SysV clean up in post + +* Sat Jan 7 2012 Clint Savage - 0.9.4-4 +- Cleaning up perms, group and descriptions, adding post scripts for systemd + +* Thu Jan 5 2012 Clint Savage - 0.9.4-3 +- Updating for systemd on Fedora 15+ + +* Thu Dec 1 2011 Clint Savage - 0.9.4-2 +- Removing requirement for Cython. Optional only for salt-minion + +* Thu Nov 30 2011 Clint Savage - 0.9.4-1 +- New upstream release with new features and bugfixes + +* Thu Nov 17 2011 Clint Savage - 0.9.3-1 +- New upstream release with new features and bugfixes + +* Sat Sep 17 2011 Clint Savage - 0.9.2-1 +- Bugfix release from upstream to fix python2.6 issues + +* Fri Sep 09 2011 Clint Savage - 0.9.1-1 +- Initial packages diff --git a/sources b/sources index e69de29..5f86891 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +c27837bac06dadfdb51b4a2b63fe6d35 salt-0.9.4.tar.gz