[salt-api] Initial import (#913296) .
Andrew Niemantsverdriet
kaptk2 at fedoraproject.org
Mon Mar 11 15:50:55 UTC 2013
commit 7f50f8f93e42b9e3ebbb66f81fb351c522edc25b
Author: Andrew Niemantsverdriet <andrewniemants at gmail.com>
Date: Mon Mar 11 09:51:07 2013 -0600
Initial import (#913296)
.
.gitignore | 1 +
salt-api | 137 +++++++++++++++++++++++++++++++++++++++++++++++
salt-api.service | 10 ++++
salt-api.spec | 157 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
sources | 1 +
5 files changed, 306 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..27dc79a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/salt-api-0.7.5.tar.gz
diff --git a/salt-api b/salt-api
new file mode 100644
index 0000000..e953d13
--- /dev/null
+++ b/salt-api
@@ -0,0 +1,137 @@
+#!/bin/sh
+#
+# Salt API
+###################################
+
+# LSB header
+
+### BEGIN INIT INFO
+# Provides: salt-api
+# Required-Start: $all
+# Required-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 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=" "
+
+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
+ daemon --check $SERVICE $SALTAPI $CONFIG_ARGS
+ 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
+}
+
+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-api.spec b/salt-api.spec
new file mode 100644
index 0000000..115932c
--- /dev/null
+++ b/salt-api.spec
@@ -0,0 +1,157 @@
+%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
+
+%define namespace saltapi
+%define eggspace salt_api
+
+%{!?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-api
+Version: 0.7.5
+Release: 3%{?dist}
+Summary: A web api for to access salt the parallel remote execution system
+
+Group: System Environment/Daemons
+License: ASL 2.0
+URL: http://github.com/saltstack/salt-api
+Source0: http://pypi.python.org/packages/source/s/%{name}/%{name}-%{version}.tar.gz
+Source1: %{name}.service
+Source2: %{name}
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildArch: noarch
+
+BuildRequires: salt
+BuildRequires: python2-devel
+
+Requires: salt
+Requires: python-cherrypy
+
+
+%if ! (0%{?rhel} >= 7 || 0%{?fedora} >= 15)
+
+Requires(post): chkconfig
+Requires(preun): chkconfig
+Requires(preun): initscripts
+Requires(postun): initscripts
+
+%else
+
+%if 0%{?systemd_preun:1}
+
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+
+%endif
+
+BuildRequires: systemd-units
+
+%endif
+
+%description
+salt-api is a modular interface on top of Salt that can provide a variety of
+entry points into a running Salt system. It can start and manage multiple
+interfaces allowing a REST API to coexist with XMLRPC or even a Websocket API.
+
+%prep
+%setup -q
+
+%build
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%{__python} setup.py install -O1 --root $RPM_BUILD_ROOT
+
+%if ! (0%{?rhel} >= 7 || 0%{?fedora} >= 15)
+mkdir -p $RPM_BUILD_ROOT%{_initrddir}
+install -p %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/
+%else
+mkdir -p $RPM_BUILD_ROOT%{_unitdir}
+install -p -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root,-)
+%doc LICENSE
+%{_bindir}/%{name}
+%{python_sitelib}/%{namespace}/*
+%{python_sitelib}/%{eggspace}-%{version}-py?.?.egg-info
+%doc %{_mandir}/man1/%{name}.1.*
+%doc %{_mandir}/man7/%{name}.7.*
+
+%if ! (0%{?rhel} >= 7 || 0%{?fedora} >= 15)
+%attr(0755, root, root) %{_initrddir}/%{name}
+%else
+%{_unitdir}/%{name}.service
+%endif
+
+# less than RHEL 8 / Fedora 16
+# not sure if RHEL 7 will use systemd yet
+%if ! (0%{?rhel} >= 7 || 0%{?fedora} >= 15)
+
+%preun
+ if [ $1 -eq 0 ] ; then
+ /sbin/service %{name} stop >/dev/null 2>&1
+ /sbin/chkconfig --del %{name}
+ fi
+
+%post
+ /sbin/chkconfig --add %{name}
+
+%postun
+ if [ "$1" -ge "1" ] ; then
+ /sbin/service %{name} condrestart >/dev/null 2>&1 || :
+ fi
+
+%else
+
+%preun
+%if 0%{?systemd_preun:1}
+ %systemd_preun %{name}.service
+%else
+ if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ /bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || :
+ /bin/systemctl stop %{name}.service > /dev/null 2>&1 || :
+ fi
+%endif
+
+%post
+%if 0%{?systemd_post:1}
+ %systemd_post %{name}.service
+%else
+ /bin/systemctl daemon-reload &>/dev/null || :
+%endif
+
+%postun
+%if 0%{?systemd_post:1}
+ %systemd_postun %{name}.service
+%else
+ /bin/systemctl daemon-reload &>/dev/null
+ [ $1 -gt 0 ] && /bin/systemctl try-restart %{name}.service &>/dev/null || :
+%endif
+
+%endif
+
+%changelog
+* Tue Feb 25 2013 Andrew Niemantsverdriet <andrewniemants at gmail.com> - 0.7.5-3
+- Added a more detailed decription
+- Removed trailing whitespace on description.
+- Added BR of python-devel
+
+* Tue Feb 25 2013 Andrew Niemantsverdriet <andrewniemants at gmail.com> - 0.7.5-2
+- Fixes as suggested by https://bugzilla.redhat.com/show_bug.cgi?id=913296#
+
+* Tue Feb 12 2013 Andrew Niemantsverdriet <andrewniemants at gmail.com> - 0.7.5-1
+- Initial package
diff --git a/sources b/sources
index e69de29..8790ec4 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+d155a4d63d9bcd6d5c7a69cfc53d8a45 salt-api-0.7.5.tar.gz
More information about the scm-commits
mailing list