Accepting request 262523 from devel:languages:python

1

OBS-URL: https://build.opensuse.org/request/show/262523
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/salt?expand=0&rev=40
This commit is contained in:
Dominique Leuenberger 2014-11-24 10:13:31 +00:00 committed by Git OBS Bridge
parent 6fd2d4cf58
commit c6bcda2c85
9 changed files with 168 additions and 268 deletions

View File

@ -1,74 +0,0 @@
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

View File

@ -1,79 +0,0 @@
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

View File

@ -1,26 +0,0 @@
From 372d68180c35213de57b0b0b5a4773ffa92a4e5e Mon Sep 17 00:00:00 2001
From: Tim Serong <tserong@suse.com>
Date: Wed, 6 Aug 2014 16:33:07 +1000
Subject: [PATCH] Disable service.py for entire SUSE family >= 12
Checking os_family allows us to pick up openSUSE and SUSE Linux Enterprise, rather than just checking for os == openSUSE.
---
salt/modules/service.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/salt/modules/service.py b/salt/modules/service.py
index cfafe24..d581916 100644
--- a/salt/modules/service.py
+++ b/salt/modules/service.py
@@ -47,7 +47,7 @@ def __virtual__():
if __grains__['kernel'] != 'Linux':
return False
# Suse >=12.0 uses systemd
- if __grains__.get('os', '') == 'openSUSE':
+ if __grains__.get('os_family', '') == 'Suse':
try:
if int(__grains__.get('osrelease', '').split('.')[0]) >= 12:
return False
--
2.0.3

View File

@ -1,31 +0,0 @@
From 1539d14a40d976b94724b14a17aff77f9a273a9a Mon Sep 17 00:00:00 2001
From: Tim Serong <tserong@suse.com>
Date: Mon, 18 Aug 2014 23:00:39 +1000
Subject: [PATCH] Fix service.py version parsing for SLE 11
"osrelease" on SLES 11 is in the form "11 SP3", i.e. major version, then a space, then service pack number. This means we can't just split on '.' to get the major number for comparisons. Rather we need to split on non-digit characters to handle both space-delimited and dot-delimited release formats (yuck).
---
salt/modules/service.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/salt/modules/service.py b/salt/modules/service.py
index d581916..dab0817 100644
--- a/salt/modules/service.py
+++ b/salt/modules/service.py
@@ -49,7 +49,12 @@ def __virtual__():
# Suse >=12.0 uses systemd
if __grains__.get('os_family', '') == 'Suse':
try:
- if int(__grains__.get('osrelease', '').split('.')[0]) >= 12:
+ # osrelease might be in decimal format (e.g. "12.1"), or for
+ # SLES might include service pack (e.g. "11 SP3"), so split on
+ # non-digit characters, and the zeroth element is the major
+ # number (it'd be so much simpler if it was always "X.Y"...)
+ import re
+ if int(re.split('\D+', __grains__.get('osrelease', ''))[0]) >= 12:
return False
except ValueError:
return False
--
2.0.3

View File

@ -1,28 +0,0 @@
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

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0ab37478e18e6490eccef4deb9f77a20c99ffcc6f97b48e25eb546f8b73f3c22
size 2846659

3
salt-2014.7.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d4a64436636a5e6839c1ae1d16052d2e965b9aed5c3c58735bd89fddb9a0ed5c
size 3518342

View File

@ -1,4 +1,85 @@
-------------------------------------------------------------------
Mon Nov 3 21:35:31 UTC 2014 - aboe76@gmail.com
- Updated to Major Release 2014.7.0
- added python-zipp as depency
- added recommend python-pygit2, this is the preferred gitfs backend of saltstack
- added zsh-completion package
- Removed Patch fix-service-py-version-parsing-sles.patch already fixed in this package
- Removed Patch pass-all-systemd-list-units.patch already fixed in this package
- Removed Patch disable-service-py-for-suse-family.patch already fixed in this package
- Removed Patch allow-systemd-units-no-unit-files.patch already fixed in this package
- Removed Patch allow-systemd-parameterized-services.patch already fixed in this package
- More information at: http://docs.saltstack.com/en/latest/topics/releases/2014.7.0.html
- SALT SSH ENHANCEMENTS:
+ Support for Fileserver Backends
+ Support for Saltfile
+ Ext Pillar
+ No more sshpass needed
+ Pure Python Shim
+ Custom Module Delivery
+ CP module Support
+ More Thin Directory Options
- Salt State System enhancements:
+ New Imperative State Keyword "Listen"
+ New Mod Aggregate Runtime Manipulator
+ New Requisites: onchanges and onfail
+ New Global onlyif and unless
+ Use names to expand and override values
- Salt Major Features:
+ Improved Scheduler Additions
+ Red Hat 7 Support
+ Fileserver Backends in Salt-call
+ Amazon Execution Modules in salt-cloud
+ LXC Runner Enhancements
+ Next Gen Docker Management
+ Peer System Performance Improvements
+ SDB Encryption at rest for configs
+ GPG Renderer encrypted pillar at rest
+ OpenStack Expansions
+ Queues System external queue systems into Salt events
+ Multi Master Failover Additions
+ Chef Execution Module
- salt-api Project Merge
+ Synchronous and Asynchronous Execution of Runner and Wheel Modules
+ rest_cherrypy Additions
+ Web Hooks
- Fileserver Backend Enhancements:
+ New gitfs Features
+ Pygit2 and Dulwich support
+ Mountpoints support
+ New hgfs Features
+ mountpoints support
+ New svnfs Features:
+ mountpoints
+ minionfs Featuressupport
+ mountpoints
- New Salt Modules:
+ Oracle
+ Random
+ Redis
+ Amazon Simple Queue Service
+ Block Device Management
+ CoreOS etcd
+ Genesis
+ InfluxDB
+ Server Density
+ Twilio Notifications
+ Varnish
+ ZNC IRC Bouncer
+ SMTP
- NEW RUNNERS:
+ Map/Reduce Style
+ Queue
- NEW EXTERNAL PILLARS:
+ CoreOS etcd
- NEW SALT-CLOUD PROVIDERS:
+ Aliyun ECS Cloud
+ LXC Containers
+ Proxmox (OpenVZ containers & KVM)
- DEPRECATIONS:
+ Salt.modules.virtualenv_mod
-------------------------------------------------------------------
Thu Oct 16 19:26:57 UTC 2014 - aboe76@gmail.com
- Updated to 2014.1.13 a bugfix release on 2014.1.12

111
salt.spec
View File

@ -16,25 +16,16 @@
#
Name: salt
Version: 2014.1.13
Version: 2014.7.0
Release: 0
Summary: A parallel remote execution system
License: Apache-2.0
Group: System/Monitoring
Url: http://saltstack.org/
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
# PATCH-FIX-UPSTREAM disable-service-py-for-suse-family.patch tserong@suse.com -- ensure salt uses systemd for services on SLES
Patch5: disable-service-py-for-suse-family.patch
# PATCH-FIX-UPSTREAM fix-service-py-version-parsing-sles.patch tserong@suse.com -- fix SLES 11 version parsing
Patch6: fix-service-py-version-parsing-sles.patch
Patch1: use-forking-daemon.patch
#for building
BuildRequires: fdupes
@ -48,7 +39,7 @@ BuildRequires: python-msgpack-python
BuildRequires: python-psutil
BuildRequires: python-pycrypto
BuildRequires: python-pyzmq
BuildRequires: python-requests
BuildRequires: python-requests >= 1.0.0
BuildRequires: python-yaml
%if 0%{?sles_version}
@ -83,6 +74,7 @@ Requires: python-requests
Requires: python-xml
Requires: python-yaml
Requires: python-yaml
Requires: python-zypp
Requires(pre): %fillup_prereq
%if 0%{?suse_version} < 1210
Requires(pre): %insserv_prereq
@ -96,6 +88,7 @@ Requires(pre): %insserv_prereq
%if %with_bashcomp
BuildRequires: bash-completion
BuildRequires: zsh
%endif #with_bashcomp
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -107,6 +100,7 @@ BuildArch: noarch
Recommends: python-botocore
Recommends: python-netaddr
Recommends: python-pygit2
%description
Salt is a distributed remote execution system used to execute commands and
@ -116,13 +110,22 @@ 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 api
Summary: The api for Salt a parallel remote execution system
Group: System/Monitoring
Requires: %{name} = %{version}
Requires: %{name}-master = %{version}
Recommends: python-CherryPy
%description api
salt-api is a modular interface on top of Salt that can provide a variety of entry points into a running Salt system.
%package cloud
Summary: Salt Cloud is a generic cloud provisioning tool
Group: System/Monitoring
Requires: %{name} = %{version}
Requires: python-PyYAML
Requires: python-apache-libcloud
Recommends: sshpass
Recommends: python-botocore
Recommends: python-netaddr
@ -149,10 +152,10 @@ Group: System/Monitoring
Requires: %{name} = %{version}
%if 0%{?suse_version} == 1315
Recommends: git
Recommends: python-GitPython
Recommends: python-pygit2
%else
Requires: git
Requires: python-GitPython
Requires: python-pygit2
%endif
Requires: python-M2Crypto
Requires: python-msgpack-python
@ -212,7 +215,6 @@ Group: System/Monitoring
Requires: %{name} = %{version}
BuildRequires: python-markupsafe
Requires: python-markupsafe
Recommends: sshpass
%if 0%{?suse_version} < 1210
Requires(pre): %insserv_prereq
%endif
@ -234,16 +236,22 @@ BuildArch: noarch
%description bash-completion
Bash command line completion support for %{name}.
%package zsh-completion
Summary: Zsh Completion for %{name}
Group: System/Management
Conflicts: salt-zsh-completion
Requires: %{name} = %{version}
Requires: zsh
BuildArch: noarch
%description zsh-completion
Zsh command line completion support for %{name}.
%endif # with_bashcomp
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%build
python setup.py build
@ -279,17 +287,21 @@ mkdir -p %{buildroot}%{_docdir}/salt
install -Dpm 0644 pkg/salt-master.service %{buildroot}%_unitdir/salt-master.service
install -Dpm 0644 pkg/salt-minion.service %{buildroot}%_unitdir/salt-minion.service
install -Dpm 0644 pkg/salt-syndic.service %{buildroot}%_unitdir/salt-syndic.service
install -Dpm 0644 pkg/salt-api.service %{buildroot}%_unitdir/salt-api.service
ln -s service %{buildroot}%{_sbindir}/rcsalt-master
ln -s service %{buildroot}%{_sbindir}/rcsalt-syndic
ln -s service %{buildroot}%{_sbindir}/rcsalt-minion
ln -s service %{buildroot}%{_sbindir}/rcsalt-api
%else
## install init scripts
install -Dpm 0755 pkg/suse/salt-master %{buildroot}%{_initddir}/salt-master
install -Dpm 0755 pkg/suse/salt-syndic %{buildroot}%{_initddir}/salt-syndic
install -Dpm 0755 pkg/suse/salt-minion %{buildroot}%{_initddir}/salt-minion
install -Dpm 0755 pkg/suse/salt-api %{buildroot}%{_initddir}/salt-api
ln -sf %{_initddir}/salt-master %{buildroot}%{_sbindir}/rcsalt-master
ln -sf %{_initddir}/salt-syndic %{buildroot}%{_sbindir}/rcsalt-syndic
ln -sf %{_initddir}/salt-minion %{buildroot}%{_sbindir}/rcsalt-minion
ln -sf %{_initddir}/salt-api %{buildroot}%{_sbindir}/rcsalt-api
%endif
#
@ -309,13 +321,14 @@ install -Dpm 0644 pkg/suse/salt.SuSEfirewall2 %{buildroot}%{_sysconfdir}/syscon
#
## install completion scripts
%if %with_bashcomp
install -Dpm 0644 pkg/salt.bash "%{buildroot}/etc/bash_completion.d/%{name}"
install -Dpm 0644 pkg/salt.bash %{buildroot}/etc/bash_completion.d/%{name}
install -Dpm 0644 scripts/completion/zsh_completion.zsh %{buildroot}/etc/zsh_completion.d/%{name}
%endif #with_bashcomp
%check
%if 0%{?suse_version} < 1310
%{__python} setup.py test --runtests-opts=-u
%endif
#%%check
#%%if 0%{?suse_version} < 1310
#%%{__python} setup.py test --runtests-opts=-u
#%%endif
%preun syndic
%if 0%{?_unitdir:1}
@ -401,6 +414,44 @@ install -Dpm 0644 pkg/salt.bash "%{buildroot}/etc/bash_completion.d/%{name}"
%restart_on_update salt-minion
%endif
%preun api
%if 0%{?_unitdir:1}
%service_del_preun salt-api.service
%else
%stop_on_removal
%endif
%pre api
%if 0%{?_unitdir:1}
%service_add_pre salt-api.service
%endif
%post api
%if 0%{?_unitdir:1}
%service_add_post salt-api.service
%else
%fillup_and_insserv
%endif
%postun api
%if 0%{?_unitdir:1}
%service_del_postun salt-api.service
%else
%insserv_cleanup
%restart_on_update
%endif
%files api
%defattr(-,root,root)
%{_bindir}/salt-api
%{_sbindir}/rcsalt-api
%if 0%{?_unitdir:1}
%_unitdir/salt-api.service
%else
%{_sysconfdir}/init.d/salt-api
%endif
%{_mandir}/man1/salt-api.1.*
%files cloud
%defattr(-,root,root)
%{_bindir}/salt-cloud
@ -475,6 +526,8 @@ install -Dpm 0644 pkg/salt.bash "%{buildroot}/etc/bash_completion.d/%{name}"
%dir %{_sysconfdir}/salt
%dir /var/log/salt
%{_bindir}/salt-call
%{_bindir}/salt-unity
%{_mandir}/man1/salt-unity.1.gz
%{_mandir}/man1/salt-call.1.gz
%{_mandir}/man7/salt.7.gz
%config(noreplace) %{_sysconfdir}/logrotate.d/salt
@ -488,6 +541,10 @@ install -Dpm 0644 pkg/salt.bash "%{buildroot}/etc/bash_completion.d/%{name}"
%defattr(-,root,root)
%config %{_sysconfdir}/bash_completion.d/%{name}
%files zsh-completion
%defattr(-,root,root)
%config %{_sysconfdir}/zsh_completion.d/%{name}
%endif #with_bashcomp
%changelog