Skip to content

Commit

Permalink
Updating spec to 0.10.4, patching bug saltstack#2335 (RHBZ#869669)
Browse files Browse the repository at this point in the history
  • Loading branch information
herlo committed Oct 24, 2012
1 parent 93b096e commit 48fe835
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
48 changes: 48 additions & 0 deletions pkg/rpm/0002-Fix-systemd-service-status.patch
@@ -0,0 +1,48 @@
From d21f01128f378cd9bbcf59e7436114594ddf08e4 Mon Sep 17 00:00:00 2001
From: "Jeffrey C. Ollie" <jeff@ocjtech.us>
Date: Tue, 23 Oct 2012 09:20:38 -0500
Subject: [PATCH] Fix systemd service status.

Under systemd, not every service has a "Main PID" so using that to
determine whether a service was running failed for a number of useful
cases, especially services that use systemd's init script
compatibility layer.

Instead, use the 'systemctl is-active' command to determine the status
of a service.
---
salt/modules/systemd.py | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/salt/modules/systemd.py b/salt/modules/systemd.py
index 2e37718..185b1d5 100644
--- a/salt/modules/systemd.py
+++ b/salt/modules/systemd.py
@@ -166,20 +166,15 @@ def reload(name):
# system
def status(name, sig=None):
'''
- Return the status for a service via systemd, returns the PID if the service
- is running or an empty string if the service is not running
+ Return the status for a service via systemd, returns a bool
+ whether the service is running.

CLI Example::

salt '*' service.status <service name>
'''
- ret = __salt__['cmd.run'](_systemctl_cmd('show', name))
- index1 = ret.find('\nMainPID=')
- index2 = ret.find('\n', index1+9)
- mainpid = ret[index1+9:index2]
- if mainpid == '0':
- return ''
- return mainpid
+ cmd = 'systemctl is-active {0}'.format(name)
+ return not __salt__['cmd.retcode'](cmd)


def enable(name):
--
1.7.11.7

8 changes: 7 additions & 1 deletion pkg/rpm/salt.spec
Expand Up @@ -9,7 +9,7 @@
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}

Name: salt
Version: 0.10.3
Version: 0.10.4
Release: 1%{?dist}
Summary: A parallel remote execution system

Expand All @@ -24,6 +24,7 @@ Source4: %{name}-master.service
Source5: %{name}-syndic.service
Source6: %{name}-minion.service
Source7: README.fedora
Patch0: 0002-Fix-systemd-service-status.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildArch: noarch
Expand Down Expand Up @@ -111,6 +112,7 @@ Salt minion is queried and controlled from the master.

%prep
%setup -q
%patch0 -p1 -b .systemd

%build

Expand Down Expand Up @@ -289,6 +291,10 @@ rm -rf $RPM_BUILD_ROOT
%endif

%changelog
* Tue Oct 24 2012 Clint Savage <herlo1@gmail.com> - 0.10.4-1
- Moved to upstream release 0.10.4
- Patched jcollie/systemd-service-status (SALT@GH#2335) (RHBZ#869669)

* Tue Oct 2 2012 Clint Savage <herlo1@gmail.com> - 0.10.3-1
- Moved to upstream release 0.10.3
- Added systemd scriplets (RHBZ#850408)
Expand Down

0 comments on commit 48fe835

Please sign in to comment.