Accepting request 242232 from devel:languages:python
1 OBS-URL: https://build.opensuse.org/request/show/242232 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/salt?expand=0&rev=32
This commit is contained in:
parent
05f3de07f5
commit
57ed0209d7
74
allow-systemd-parameterized-services.patch
Normal file
74
allow-systemd-parameterized-services.patch
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
From 9617d339273ceecd3b47cbcd8c331080faac48f8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Massimiliano Torromeo <massimilianotorromeo@artera.it>
|
||||||
|
Date: Mon, 14 Apr 2014 18:01:18 +0200
|
||||||
|
Subject: [PATCH] Allow systemd parametrized services to be enabled by the
|
||||||
|
service state.
|
||||||
|
|
||||||
|
This makes the systemd.get_all function return the combined output of
|
||||||
|
list-units and list-unit-files and the systemd.available function will
|
||||||
|
also check for the base unit name stripped of the user parameter
|
||||||
|
(e.g. dhcpcd@eth0 will be considered available if dhcpcd@.service exists)
|
||||||
|
---
|
||||||
|
salt/modules/systemd.py | 18 +++++++++++++-----
|
||||||
|
1 file changed, 13 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/salt/modules/systemd.py b/salt/modules/systemd.py
|
||||||
|
index e2cfb1d..72079d7 100644
|
||||||
|
--- a/salt/modules/systemd.py
|
||||||
|
+++ b/salt/modules/systemd.py
|
||||||
|
@@ -82,7 +82,7 @@ def _get_all_units():
|
||||||
|
r')\s+loaded\s+(?P<active>[^\s]+)')
|
||||||
|
|
||||||
|
out = __salt__['cmd.run_stdout'](
|
||||||
|
- 'systemctl --full list-units | col -b'
|
||||||
|
+ 'systemctl --full --no-legend --no-pager list-units | col -b'
|
||||||
|
)
|
||||||
|
|
||||||
|
ret = {}
|
||||||
|
@@ -104,7 +104,7 @@ def _get_all_unit_files():
|
||||||
|
r')\s+(?P<state>.+)$')
|
||||||
|
|
||||||
|
out = __salt__['cmd.run_stdout'](
|
||||||
|
- 'systemctl --full list-unit-files | col -b'
|
||||||
|
+ 'systemctl --full --no-legend --no-pager list-unit-files | col -b'
|
||||||
|
)
|
||||||
|
|
||||||
|
ret = {}
|
||||||
|
@@ -195,7 +195,7 @@ def get_all():
|
||||||
|
|
||||||
|
salt '*' service.get_all
|
||||||
|
'''
|
||||||
|
- return sorted(_get_all_units().keys())
|
||||||
|
+ return sorted(set(_get_all_units().keys() + _get_all_unit_files().keys()))
|
||||||
|
|
||||||
|
|
||||||
|
def available(name):
|
||||||
|
@@ -209,7 +209,15 @@ def available(name):
|
||||||
|
|
||||||
|
salt '*' service.available sshd
|
||||||
|
'''
|
||||||
|
- return _canonical_template_unit_name(name) in get_all()
|
||||||
|
+ name = _canonical_template_unit_name(name)
|
||||||
|
+ units = get_all()
|
||||||
|
+ if name in units:
|
||||||
|
+ return True
|
||||||
|
+ elif '@' in name:
|
||||||
|
+ templatename = name[:name.find('@') + 1]
|
||||||
|
+ return templatename in units
|
||||||
|
+ else:
|
||||||
|
+ return False
|
||||||
|
|
||||||
|
|
||||||
|
def missing(name):
|
||||||
|
@@ -224,7 +232,7 @@ def missing(name):
|
||||||
|
|
||||||
|
salt '*' service.missing sshd
|
||||||
|
'''
|
||||||
|
- return not _canonical_template_unit_name(name) in get_all()
|
||||||
|
+ return not available(name)
|
||||||
|
|
||||||
|
|
||||||
|
def start(name):
|
||||||
|
--
|
||||||
|
1.9.3
|
||||||
|
|
79
allow-systemd-units-no-unit-files.patch
Normal file
79
allow-systemd-units-no-unit-files.patch
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
From 90bece1faa1862465e97f7caf262c65cd84583ff Mon Sep 17 00:00:00 2001
|
||||||
|
From: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
|
||||||
|
Date: Fri, 11 Apr 2014 14:43:02 +0200
|
||||||
|
Subject: [PATCH] Allow systemd units no provided by unit files to be handled.
|
||||||
|
|
||||||
|
This allows to query status, start, stop, restart and list units that
|
||||||
|
are not actually provided by unit files. Such units cannot be
|
||||||
|
enabled/disabled and that's why those actions still prefer the
|
||||||
|
"list-unit-files" output over "list-units".
|
||||||
|
|
||||||
|
Units that couldn't be handled otherwise include for example mount
|
||||||
|
units and sysvinit compatibility units such as those present on
|
||||||
|
debian systems.
|
||||||
|
|
||||||
|
The output of a "service.running ssh" state on a debian wheezy target
|
||||||
|
is:
|
||||||
|
|
||||||
|
ID: ssh
|
||||||
|
Function: service.running
|
||||||
|
Result: False
|
||||||
|
Comment: The named service ssh is not available
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
after this patch:
|
||||||
|
|
||||||
|
ID: ssh
|
||||||
|
Function: service.running
|
||||||
|
Result: True
|
||||||
|
Comment: The service ssh is already running
|
||||||
|
Changes:
|
||||||
|
---
|
||||||
|
salt/modules/systemd.py | 24 +++++++++++++++++++++++-
|
||||||
|
1 file changed, 23 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/salt/modules/systemd.py b/salt/modules/systemd.py
|
||||||
|
index 57b55f5..e2cfb1d 100644
|
||||||
|
--- a/salt/modules/systemd.py
|
||||||
|
+++ b/salt/modules/systemd.py
|
||||||
|
@@ -72,6 +72,28 @@ def _systemctl_cmd(action, name):
|
||||||
|
return 'systemctl {0} {1}'.format(action, _canonical_unit_name(name))
|
||||||
|
|
||||||
|
|
||||||
|
+def _get_all_units():
|
||||||
|
+ '''
|
||||||
|
+ Get all units and their state. Units ending in .service
|
||||||
|
+ are normalized so that they can be referenced without a type suffix.
|
||||||
|
+ '''
|
||||||
|
+ rexp = re.compile(r'(?m)^(?P<name>.+)\.(?P<type>' +
|
||||||
|
+ '|'.join(VALID_UNIT_TYPES) +
|
||||||
|
+ r')\s+loaded\s+(?P<active>[^\s]+)')
|
||||||
|
+
|
||||||
|
+ out = __salt__['cmd.run_stdout'](
|
||||||
|
+ 'systemctl --full list-units | col -b'
|
||||||
|
+ )
|
||||||
|
+
|
||||||
|
+ ret = {}
|
||||||
|
+ for match in rexp.finditer(out):
|
||||||
|
+ name = match.group('name')
|
||||||
|
+ if match.group('type') != 'service':
|
||||||
|
+ name += '.' + match.group('type')
|
||||||
|
+ ret[name] = match.group('active')
|
||||||
|
+ return ret
|
||||||
|
+
|
||||||
|
+
|
||||||
|
def _get_all_unit_files():
|
||||||
|
'''
|
||||||
|
Get all unit files and their state. Unit files ending in .service
|
||||||
|
@@ -173,7 +195,7 @@ def get_all():
|
||||||
|
|
||||||
|
salt '*' service.get_all
|
||||||
|
'''
|
||||||
|
- return sorted(_get_all_unit_files().keys())
|
||||||
|
+ return sorted(_get_all_units().keys())
|
||||||
|
|
||||||
|
|
||||||
|
def available(name):
|
||||||
|
--
|
||||||
|
1.9.3
|
||||||
|
|
28
pass-all-systemd-list-units.patch
Normal file
28
pass-all-systemd-list-units.patch
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
From 968b26f45351d790a9fa2afd9bbd6c5bb31f13d5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Tim Serong <tserong@suse.com>
|
||||||
|
Date: Mon, 7 Jul 2014 21:14:26 +1000
|
||||||
|
Subject: [PATCH] Pass --all when invoking `systemctl list-units`
|
||||||
|
|
||||||
|
`systemctl list-units` without --all won't list services that aren't
|
||||||
|
actually running. See https://github.com/saltstack/salt/issues/13788
|
||||||
|
for some further discussion.
|
||||||
|
---
|
||||||
|
salt/modules/systemd.py | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/salt/modules/systemd.py b/salt/modules/systemd.py
|
||||||
|
index ca93986..036adb4 100644
|
||||||
|
--- a/salt/modules/systemd.py
|
||||||
|
+++ b/salt/modules/systemd.py
|
||||||
|
@@ -82,7 +82,7 @@ def _get_all_units():
|
||||||
|
r')\s+loaded\s+(?P<active>[^\s]+)')
|
||||||
|
|
||||||
|
out = __salt__['cmd.run_stdout'](
|
||||||
|
- 'systemctl --full --no-legend --no-pager list-units | col -b'
|
||||||
|
+ 'systemctl --all --full --no-legend --no-pager list-units | col -b'
|
||||||
|
)
|
||||||
|
|
||||||
|
ret = {}
|
||||||
|
--
|
||||||
|
1.9.3
|
||||||
|
|
17
salt.changes
17
salt.changes
@ -1,3 +1,20 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Jul 24 13:11:03 UTC 2014 - tserong@suse.com
|
||||||
|
|
||||||
|
- Allow salt to correctly detect services provided by init scripts
|
||||||
|
+ Added allow-systemd-units-no-unit-files.patch
|
||||||
|
+ Added allow-systemd-parameterized-services.patch
|
||||||
|
+ Added pass-all-systemd-list-units.patch
|
||||||
|
- Move systemd service file fix to patch, add PIDFile parameter (this
|
||||||
|
fix is applicable for all SUSE versions, not just 12.3)
|
||||||
|
+ Added use-forking-daemon.patch
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jul 23 06:24:00 UTC 2014 - aboe76@gmail.com
|
||||||
|
|
||||||
|
- Improve systemd service file fix for 12.3
|
||||||
|
Use forking instead of Simple and daemonize salt-master process
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sat Jul 19 07:58:18 UTC 2014 - aboe76@gmail.com
|
Sat Jul 19 07:58:18 UTC 2014 - aboe76@gmail.com
|
||||||
|
|
||||||
|
33
salt.spec
33
salt.spec
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package salt
|
# spec file for package salt
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -24,6 +24,14 @@ License: Apache-2.0
|
|||||||
Group: System/Monitoring
|
Group: System/Monitoring
|
||||||
Url: http://saltstack.org/
|
Url: http://saltstack.org/
|
||||||
Source0: http://pypi.python.org/packages/source/s/%{name}/%{name}-%{version}.tar.gz
|
Source0: http://pypi.python.org/packages/source/s/%{name}/%{name}-%{version}.tar.gz
|
||||||
|
# PATCH-FIX-UPSTREAM allow-systemd-units-no-unit-files.patch tserong@suse.com -- allow salt to detect init script services
|
||||||
|
Patch1: allow-systemd-units-no-unit-files.patch
|
||||||
|
# PATCH-FIX-UPSTREAM allow-systemd-units-no-unit-files.patch tserong@suse.com -- part 2 of above fix
|
||||||
|
Patch2: allow-systemd-parameterized-services.patch
|
||||||
|
# PATCH-FIX-UPSTREAM pass-all-systemd-list-units.patch tserong@suse.com -- part 3 of above fix
|
||||||
|
Patch3: pass-all-systemd-list-units.patch
|
||||||
|
# PATCH-FIX-OPENSUSE use-forking-daemon.patch tserong@suse.com -- We don't have python-systemd, so notify can't work
|
||||||
|
Patch4: use-forking-daemon.patch
|
||||||
|
|
||||||
#for building
|
#for building
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
@ -31,14 +39,14 @@ BuildRequires: logrotate
|
|||||||
BuildRequires: python-Jinja2
|
BuildRequires: python-Jinja2
|
||||||
BuildRequires: python-M2Crypto
|
BuildRequires: python-M2Crypto
|
||||||
BuildRequires: python-PyYAML
|
BuildRequires: python-PyYAML
|
||||||
BuildRequires: python-yaml
|
BuildRequires: python-apache-libcloud >= 0.14.0
|
||||||
BuildRequires: python-devel
|
BuildRequires: python-devel
|
||||||
BuildRequires: python-msgpack-python
|
BuildRequires: python-msgpack-python
|
||||||
|
BuildRequires: python-psutil
|
||||||
BuildRequires: python-pycrypto
|
BuildRequires: python-pycrypto
|
||||||
BuildRequires: python-pyzmq
|
BuildRequires: python-pyzmq
|
||||||
BuildRequires: python-psutil
|
|
||||||
BuildRequires: python-requests
|
BuildRequires: python-requests
|
||||||
BuildRequires: python-apache-libcloud >= 0.14.0
|
BuildRequires: python-yaml
|
||||||
|
|
||||||
%if 0%{?sles_version}
|
%if 0%{?sles_version}
|
||||||
BuildRequires: python
|
BuildRequires: python
|
||||||
@ -65,13 +73,13 @@ BuildRequires: python-sphinx
|
|||||||
|
|
||||||
Requires: logrotate
|
Requires: logrotate
|
||||||
Requires: python-Jinja2
|
Requires: python-Jinja2
|
||||||
Requires: python-yaml
|
|
||||||
Requires: python-PyYAML
|
Requires: python-PyYAML
|
||||||
Requires: python-yaml
|
|
||||||
Requires: python-apache-libcloud
|
Requires: python-apache-libcloud
|
||||||
Requires: python-xml
|
|
||||||
Requires: python-psutil
|
Requires: python-psutil
|
||||||
Requires: python-requests
|
Requires: python-requests
|
||||||
|
Requires: python-xml
|
||||||
|
Requires: python-yaml
|
||||||
|
Requires: python-yaml
|
||||||
Requires(pre): %fillup_prereq
|
Requires(pre): %fillup_prereq
|
||||||
%if 0%{?suse_version} < 1210
|
%if 0%{?suse_version} < 1210
|
||||||
Requires(pre): %insserv_prereq
|
Requires(pre): %insserv_prereq
|
||||||
@ -87,7 +95,6 @@ Requires(pre): %insserv_prereq
|
|||||||
BuildRequires: bash-completion
|
BuildRequires: bash-completion
|
||||||
%endif #with_bashcomp
|
%endif #with_bashcomp
|
||||||
|
|
||||||
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
|
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
|
||||||
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
||||||
@ -98,7 +105,6 @@ BuildArch: noarch
|
|||||||
Recommends: python-botocore
|
Recommends: python-botocore
|
||||||
Recommends: python-netaddr
|
Recommends: python-netaddr
|
||||||
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Salt is a distributed remote execution system used to execute commands and
|
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
|
query data. It was developed in order to bring the best solutions found in
|
||||||
@ -224,6 +230,10 @@ Bash command line completion support for %{name}.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%patch1 -p1
|
||||||
|
%patch2 -p1
|
||||||
|
%patch3 -p1
|
||||||
|
%patch4 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
python setup.py build
|
python setup.py build
|
||||||
@ -254,11 +264,6 @@ mkdir -p %{buildroot}/srv/salt
|
|||||||
mkdir -p %{buildroot}/srv/pillar
|
mkdir -p %{buildroot}/srv/pillar
|
||||||
mkdir -p %{buildroot}%{_docdir}/salt
|
mkdir -p %{buildroot}%{_docdir}/salt
|
||||||
|
|
||||||
## fix opensuse 12.3 systemd service file
|
|
||||||
%if 0%{?suse_version} == 1230
|
|
||||||
sed -i 's/^Type=notify/Type=simple/g' pkg/salt-master.service
|
|
||||||
%endif
|
|
||||||
|
|
||||||
## install init and systemd scripts
|
## install init and systemd scripts
|
||||||
%if 0%{?_unitdir:1}
|
%if 0%{?_unitdir:1}
|
||||||
install -Dpm 0644 pkg/salt-master.service %{buildroot}%_unitdir/salt-master.service
|
install -Dpm 0644 pkg/salt-master.service %{buildroot}%_unitdir/salt-master.service
|
||||||
|
17
use-forking-daemon.patch
Normal file
17
use-forking-daemon.patch
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
Index: salt-2014.1.7/pkg/salt-master.service
|
||||||
|
===================================================================
|
||||||
|
--- salt-2014.1.7.orig/pkg/salt-master.service
|
||||||
|
+++ salt-2014.1.7/pkg/salt-master.service
|
||||||
|
@@ -3,8 +3,10 @@ Description=The Salt Master Server
|
||||||
|
After=syslog.target network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
-Type=notify
|
||||||
|
-ExecStart=/usr/bin/salt-master
|
||||||
|
+Type=forking
|
||||||
|
+ExecStart=/usr/bin/salt-master --daemon
|
||||||
|
+# Daemon mode doesn't seem to work reliably without PIDFile
|
||||||
|
+PIDFile=/var/run/salt-master.pid
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user