SHA256
1
0
forked from pool/salt

Accepting request 431090 from systemsmanagement:saltstack:testing

- Rename susemanager plugin to zyppnotify, as it is not SUSE Manager specific
- Remove the subpackage and put the plugin back to the main package
- Revert the github->pypi Source change, as github is the official URL
  according to upstream
  Add:
  * 0007-Add-zypp-notify-plugin.patch
  Remove:
  * 0007-Add-SUSE-Manager-plugin.patch

- Add upstream patch to fix pkg.upgrade for zypper
  Add:
  * 0021-Fix-pkg.upgrade-for-zypper.patch

OBS-URL: https://build.opensuse.org/request/show/431090
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=78
This commit is contained in:
Klaus Kämpf 2016-09-28 13:09:18 +00:00 committed by Git OBS Bridge
parent 14ef6d2b51
commit b518bfd22e
4 changed files with 78 additions and 41 deletions

View File

@ -1,34 +1,34 @@
From 65a32350589712835294bb5e671c42ef1d331df8 Mon Sep 17 00:00:00 2001 From c0aacf83fa51015fb6e50ab96204a7b3c31413a8 Mon Sep 17 00:00:00 2001
From: Bo Maryniuk <bo@suse.de> From: Bo Maryniuk <bo@suse.de>
Date: Mon, 9 May 2016 10:33:44 +0200 Date: Mon, 9 May 2016 10:33:44 +0200
Subject: [PATCH 07/13] Add SUSE Manager plugin Subject: [PATCH 07/21] Add zypp-notify plugin
* Add unit test to the libzypp drift detector plugin * Add unit test to the libzypp drift detector plugin
--- ---
scripts/zypper/plugins/commit/README.md | 3 ++ scripts/zypper/plugins/commit/README.md | 3 ++
scripts/zypper/plugins/commit/susemanager | 59 ++++++++++++++++++++++++++++ scripts/zypper/plugins/commit/zyppnotify | 59 +++++++++++++++++++++++++++++
tests/unit/zypp_plugins_test.py | 51 ++++++++++++++++++++++++ tests/unit/zypp_plugins_test.py | 51 +++++++++++++++++++++++++
tests/zypp_plugin.py | 64 +++++++++++++++++++++++++++++++ tests/zypp_plugin.py | 64 ++++++++++++++++++++++++++++++++
4 files changed, 177 insertions(+) 4 files changed, 177 insertions(+)
create mode 100644 scripts/zypper/plugins/commit/README.md create mode 100644 scripts/zypper/plugins/commit/README.md
create mode 100755 scripts/zypper/plugins/commit/susemanager create mode 100755 scripts/zypper/plugins/commit/zyppnotify
create mode 100644 tests/unit/zypp_plugins_test.py create mode 100644 tests/unit/zypp_plugins_test.py
create mode 100644 tests/zypp_plugin.py create mode 100644 tests/zypp_plugin.py
diff --git a/scripts/zypper/plugins/commit/README.md b/scripts/zypper/plugins/commit/README.md diff --git a/scripts/zypper/plugins/commit/README.md b/scripts/zypper/plugins/commit/README.md
new file mode 100644 new file mode 100644
index 000000000000..01c8917c8e0a index 0000000..01c8917
--- /dev/null --- /dev/null
+++ b/scripts/zypper/plugins/commit/README.md +++ b/scripts/zypper/plugins/commit/README.md
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
+# Zypper plugins +# Zypper plugins
+ +
+Plugins here are required to interact with SUSE Manager in conjunction of SaltStack and Zypper. +Plugins here are required to interact with SUSE Manager in conjunction of SaltStack and Zypper.
diff --git a/scripts/zypper/plugins/commit/susemanager b/scripts/zypper/plugins/commit/susemanager diff --git a/scripts/zypper/plugins/commit/zyppnotify b/scripts/zypper/plugins/commit/zyppnotify
new file mode 100755 new file mode 100755
index 000000000000..268298b10811 index 0000000..268298b
--- /dev/null --- /dev/null
+++ b/scripts/zypper/plugins/commit/susemanager +++ b/scripts/zypper/plugins/commit/zyppnotify
@@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
+#!/usr/bin/python +#!/usr/bin/python
+# +#
@ -91,7 +91,7 @@ index 000000000000..268298b10811
+DriftDetector().main() +DriftDetector().main()
diff --git a/tests/unit/zypp_plugins_test.py b/tests/unit/zypp_plugins_test.py diff --git a/tests/unit/zypp_plugins_test.py b/tests/unit/zypp_plugins_test.py
new file mode 100644 new file mode 100644
index 000000000000..6075288aad39 index 0000000..550403c
--- /dev/null --- /dev/null
+++ b/tests/unit/zypp_plugins_test.py +++ b/tests/unit/zypp_plugins_test.py
@@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
@ -119,8 +119,8 @@ index 000000000000..6075288aad39
+import imp +import imp
+from zypp_plugin import BogusIO +from zypp_plugin import BogusIO
+ +
+susemanager = imp.load_source('susemanager', os.path.sep.join(os.path.dirname(__file__).split( +zyppnotify = imp.load_source('zyppnotify', os.path.sep.join(os.path.dirname(__file__).split(
+ os.path.sep)[:-2] + ['scripts', 'zypper', 'plugins', 'commit', 'susemanager'])) + os.path.sep)[:-2] + ['scripts', 'zypper', 'plugins', 'commit', 'zyppnotify']))
+ +
+@skipIf(NO_MOCK, NO_MOCK_REASON) +@skipIf(NO_MOCK, NO_MOCK_REASON)
+class ZyppPluginsTestCase(TestCase): +class ZyppPluginsTestCase(TestCase):
@ -133,11 +133,11 @@ index 000000000000..6075288aad39
+ Returns: + Returns:
+ +
+ ''' + '''
+ drift = susemanager.DriftDetector() + drift = zyppnotify.DriftDetector()
+ drift._get_mtime = MagicMock(return_value=123) + drift._get_mtime = MagicMock(return_value=123)
+ drift._get_checksum = MagicMock(return_value='deadbeef') + drift._get_checksum = MagicMock(return_value='deadbeef')
+ bogus_io = BogusIO() + bogus_io = BogusIO()
+ with patch('susemanager.open', bogus_io): + with patch('zyppnotify.open', bogus_io):
+ drift.PLUGINEND(None, None) + drift.PLUGINEND(None, None)
+ self.assertEqual(str(bogus_io), 'deadbeef 123\n') + self.assertEqual(str(bogus_io), 'deadbeef 123\n')
+ self.assertEqual(bogus_io.mode, 'w') + self.assertEqual(bogus_io.mode, 'w')
@ -148,7 +148,7 @@ index 000000000000..6075288aad39
+ run_tests(ZyppPluginsTestCase, needs_daemon=False) + run_tests(ZyppPluginsTestCase, needs_daemon=False)
diff --git a/tests/zypp_plugin.py b/tests/zypp_plugin.py diff --git a/tests/zypp_plugin.py b/tests/zypp_plugin.py
new file mode 100644 new file mode 100644
index 000000000000..218f70381146 index 0000000..218f703
--- /dev/null --- /dev/null
+++ b/tests/zypp_plugin.py +++ b/tests/zypp_plugin.py
@@ -0,0 +1,64 @@ @@ -0,0 +1,64 @@
@ -217,5 +217,5 @@ index 000000000000..218f70381146
+ ''' + '''
+ self.closed = True + self.closed = True
-- --
2.8.3 2.10.0

View File

@ -0,0 +1,31 @@
From 2cac0c3839af12b0a474f4cb0c0854995cd8dc2a Mon Sep 17 00:00:00 2001
From: "C. R. Oldham" <cro@ncbt.org>
Date: Wed, 21 Sep 2016 20:05:33 -0600
Subject: [PATCH 21/21] Fix pkg.upgrade for zypper
---
salt/modules/zypper.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
index 4bb9a09..21b87b0 100644
--- a/salt/modules/zypper.py
+++ b/salt/modules/zypper.py
@@ -1079,10 +1079,11 @@ def upgrade(refresh=True, skip_verify=False):
refresh_db()
old = list_pkgs()
- to_append = ''
if skip_verify:
- to_append = '--no-gpg-checks'
- __zypper__.noraise.call('update', '--auto-agree-with-licenses', to_append)
+ __zypper__.noraise.call('update', '--auto-agree-with-licenses', '--no-gpg-checks')
+ else:
+ __zypper__.noraise.call('update', '--auto-agree-with-licenses')
+
if __zypper__.exit_code not in __zypper__.SUCCESS_EXIT_CODES:
ret['result'] = False
ret['comment'] = (__zypper__.stdout() + os.linesep + __zypper__.stderr()).strip()
--
2.10.0

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Wed Sep 28 12:35:32 UTC 2016 - tampakrap@opensuse.org
- Rename susemanager plugin to zyppnotify, as it is not SUSE Manager specific
- Remove the subpackage and put the plugin back to the main package
- Revert the github->pypi Source change, as github is the official URL
according to upstream
Add:
* 0007-Add-zypp-notify-plugin.patch
Remove:
* 0007-Add-SUSE-Manager-plugin.patch
-------------------------------------------------------------------
Wed Sep 28 11:40:36 UTC 2016 - tampakrap@opensuse.org
- Add upstream patch to fix pkg.upgrade for zypper
Add:
* 0021-Fix-pkg.upgrade-for-zypper.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Sep 27 23:55:03 UTC 2016 - mrueckert@suse.de Tue Sep 27 23:55:03 UTC 2016 - mrueckert@suse.de

View File

@ -48,6 +48,7 @@ Source0: https://github.com/saltstack/salt/releases/download/v%{version}/
Source1: README.SUSE Source1: README.SUSE
Source2: salt-tmpfiles.d Source2: salt-tmpfiles.d
Source3: html.tar.bz2 Source3: html.tar.bz2
Source4: update-documentation.sh
# PATCH-FIX-OPENSUSE use-forking-daemon.patch tserong@suse.com -- We don't have python-systemd, so notify can't work # PATCH-FIX-OPENSUSE use-forking-daemon.patch tserong@suse.com -- We don't have python-systemd, so notify can't work
# We do not upstream this patch because this is something that we have to fix on our side # We do not upstream this patch because this is something that we have to fix on our side
@ -71,7 +72,7 @@ Patch6: 0006-Create-salt-proxy-instantiated-service-file.patch
# PATCH-FIX-OPENSUSE Generate events from the Salt minion, # PATCH-FIX-OPENSUSE Generate events from the Salt minion,
# if Zypper has been used outside the Salt infrastructure # if Zypper has been used outside the Salt infrastructure
# We do not upstream this because this is for SUSE only (15.08.2016) # We do not upstream this because this is for SUSE only (15.08.2016)
Patch7: 0007-Add-SUSE-Manager-plugin.patch Patch7: 0007-Add-zypp-notify-plugin.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/33469 # PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/33469
# PR already merged. This will be gone in the next version # PR already merged. This will be gone in the next version
Patch8: 0008-checksum-validation-when-zypper-pkg.download.patch Patch8: 0008-checksum-validation-when-zypper-pkg.download.patch
@ -107,6 +108,8 @@ Patch18: 0018-Unit-tests-fixes-for-2016.3.2.patch
Patch19: 0019-Fix-snapper_test-for-python26.patch Patch19: 0019-Fix-snapper_test-for-python26.patch
# PATCH-FIX-UPSTREAM https://github.com/saltstack/salt/pull/36263 # PATCH-FIX-UPSTREAM https://github.com/saltstack/salt/pull/36263
Patch20: 0020-Integration-tests-fixes-for-2016.3.2.patch Patch20: 0020-Integration-tests-fixes-for-2016.3.2.patch
# PATCH-FIX-UPSTREAM https://github.com/saltstack/salt/pull/36495
Patch21: 0021-Fix-pkg.upgrade-for-zypper.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -459,20 +462,6 @@ Zsh command line completion support for %{name}.
%endif %endif
%if 0%{?suse_version}
%package susemanager
Summary: SUSE Manager Integration
Group: System/Management
Requires: %{name} = %{version}-%{release}
%if 0%{?suse_version} > 1110
BuildArch: noarch
%endif
%description susemanager
SUSE Manager Integration for various tools on the system.
%endif
%prep %prep
%setup -q -n salt-%{version} %setup -q -n salt-%{version}
cp %{S:1} . cp %{S:1} .
@ -559,7 +548,7 @@ install -Dd -m 0750 %{buildroot}%{_sysconfdir}/salt/pki/minion
## Install Zypper plugins only on SUSE machines ## Install Zypper plugins only on SUSE machines
%if 0%{?suse_version} %if 0%{?suse_version}
install -Dd -m 0750 %{buildroot}%{_prefix}/lib/zypp/plugins/commit install -Dd -m 0750 %{buildroot}%{_prefix}/lib/zypp/plugins/commit
%{__install} scripts/zypper/plugins/commit/susemanager %{buildroot}%{_prefix}/lib/zypp/plugins/commit/susemanager %{__install} scripts/zypper/plugins/commit/zyppnotify %{buildroot}%{_prefix}/lib/zypp/plugins/commit/zyppnotify
%endif %endif
## install init and systemd scripts ## install init and systemd scripts
@ -904,6 +893,11 @@ fi
#%dir %ghost %attr(0750, root, salt) %{_localstatedir}/run/salt/minion #%dir %ghost %attr(0750, root, salt) %{_localstatedir}/run/salt/minion
%{_sbindir}/rcsalt-minion %{_sbindir}/rcsalt-minion
# Install plugin only on SUSE machines
%if 0%{?suse_version}
%{_prefix}/lib/zypp/plugins/commit/zyppnotify
%endif
%if %{with systemd} %if %{with systemd}
%{_unitdir}/salt-minion.service %{_unitdir}/salt-minion.service
%else %else
@ -1015,11 +1009,4 @@ fi
%dir %{fish_dir} %dir %{fish_dir}
%endif %endif
# Install plugin only on SUSE machines
%if 0%{?suse_version}
%files susemanager
%defattr(-,root,root)
%{_prefix}/lib/zypp/plugins/commit/susemanager
%endif
%changelog %changelog