Hello community,

here is the log from the commit of package salt for openSUSE:Factory checked in 
at 2020-07-15 11:12:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/salt (Old)
 and      /work/SRC/openSUSE:Factory/.salt.new.3060 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "salt"

Wed Jul 15 11:12:44 2020 rev:106 rq:819714 version:3000.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/salt/salt.changes        2020-06-02 
14:33:56.214628794 +0200
+++ /work/SRC/openSUSE:Factory/.salt.new.3060/salt.changes      2020-07-15 
11:13:19.400901932 +0200
@@ -1,0 +2,20 @@
+Fri Jul  3 13:19:02 UTC 2020 - Jochen Breuer <[email protected]>
+
+- Fix the registration of libvirt pool and nodedev events
+- Accept nested namespaces in spacewalk.api runner function. (bsc#1172211)
+- info_installed works without status attr now (bsc#1171461)
+
+- Added:
+  * info_installed-works-without-status-attr-now.patch
+  * opensuse-3000.3-spacewalk-runner-parse-command-250.patch
+  * opensuse-3000-libvirt-engine-fixes-251.patch
+
+-------------------------------------------------------------------
+Thu May 28 16:01:10 UTC 2020 - Pablo Suárez Hernández 
<[email protected]>
+
+- Avoid traceback on debug logging for swarm module (bsc#1172075)
+
+- Added:
+  * avoid-has_docker-true-if-import-messes-with-salt.uti.patch
+
+-------------------------------------------------------------------

New:
----
  avoid-has_docker-true-if-import-messes-with-salt.uti.patch
  info_installed-works-without-status-attr-now.patch
  opensuse-3000-libvirt-engine-fixes-251.patch
  opensuse-3000.3-spacewalk-runner-parse-command-250.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ salt.spec ++++++
--- /var/tmp/diff_new_pack.7G2XOg/_old  2020-07-15 11:13:23.804906291 +0200
+++ /var/tmp/diff_new_pack.7G2XOg/_new  2020-07-15 11:13:23.808906295 +0200
@@ -318,6 +318,14 @@
 Patch117:     zypperpkg-filter-patterns-that-start-with-dot-244.patch
 # PATCH-FIX_OPENSUSE: 
hhttps://github.com/openSUSE/salt/commit/da936daeebd701e147707ad814c07bfc259d4be
 Patch118:     add-publish_batch-to-clearfuncs-exposed-methods.patch
+# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/57489
+Patch119:     avoid-has_docker-true-if-import-messes-with-salt.uti.patch
+# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/57779
+Patch120:     info_installed-works-without-status-attr-now.patch
+# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/57491
+Patch121:     opensuse-3000.3-spacewalk-runner-parse-command-250.patch
+# PATCH-FIX_UPSTREAM: https://github.com/openSUSE/salt/pull/251
+Patch122:     opensuse-3000-libvirt-engine-fixes-251.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  logrotate
@@ -942,6 +950,10 @@
 %patch116 -p1
 %patch117 -p1
 %patch118 -p1
+%patch119 -p1
+%patch120 -p1
+%patch121 -p1
+%patch122 -p1
 
 %build
 %if 0%{?build_py2}

++++++ _lastrevision ++++++
--- /var/tmp/diff_new_pack.7G2XOg/_old  2020-07-15 11:13:23.860906346 +0200
+++ /var/tmp/diff_new_pack.7G2XOg/_new  2020-07-15 11:13:23.860906346 +0200
@@ -1 +1 @@
-fb1212e6b081322ac0e32bb841293b347bcb4b62
\ No newline at end of file
+82be64a05e54109be6af70998d154fe62150ce9c
\ No newline at end of file

++++++ avoid-has_docker-true-if-import-messes-with-salt.uti.patch ++++++
>From f942aeb3eb64b99cd9432bebf021835ade46df74 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
 <[email protected]>
Date: Thu, 28 May 2020 16:38:04 +0100
Subject: [PATCH] Avoid HAS_DOCKER true if import messes with
 salt.utils.docker (bsc#1172075)

---
 salt/modules/swarm.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/salt/modules/swarm.py b/salt/modules/swarm.py
index 
ea327ce640040bdbd7e7077bc6bbb59a9f0ade4a..6f16f41ece01738f3a04d11211fa5e96cd8155b4
 100644
--- a/salt/modules/swarm.py
+++ b/salt/modules/swarm.py
@@ -30,9 +30,13 @@ from __future__ import absolute_import, unicode_literals, 
print_function
 # Import Salt libs
 import salt.utils.json
 
+HAS_DOCKER = False
+
 try:
     import docker
-    HAS_DOCKER = True
+
+    if hasattr(docker, "from_env"):
+        HAS_DOCKER = True
 except ImportError:
     HAS_DOCKER = False
 
-- 
2.23.0


++++++ info_installed-works-without-status-attr-now.patch ++++++
>From 8275c229fcca0e43513ea680e48cbf6263247b41 Mon Sep 17 00:00:00 2001
From: Jochen Breuer <[email protected]>
Date: Tue, 19 May 2020 10:34:35 +0200
Subject: [PATCH] info_installed works without status attr now

If 'status' was excluded via attr, info_installed was no longer able to
detect if a package was installed or not. Now info_installed adds the
'status' for the 'lowpkg.info' request again.
---
 salt/modules/aptpkg.py            |  9 +++++++++
 tests/unit/modules/test_aptpkg.py | 17 +++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/salt/modules/aptpkg.py b/salt/modules/aptpkg.py
index 2835d32263..765d69aff2 100644
--- a/salt/modules/aptpkg.py
+++ b/salt/modules/aptpkg.py
@@ -2867,6 +2867,15 @@ def info_installed(*names, **kwargs):
     failhard = kwargs.pop('failhard', True)
     kwargs.pop('errors', None)                # Only for compatibility with RPM
     attr = kwargs.pop('attr', None)           # Package attributes to return
+
+    # status is needed to see if a package is installed. So we have to add it,
+    # even if it's excluded via attr parameter. Otherwise all packages are
+    # returned.
+    if attr:
+        attr_list = set(attr.split(','))
+        attr_list.add('status')
+        attr = ','.join(attr_list)
+
     all_versions = kwargs.pop('all_versions', False)  # This is for backward 
compatible structure only
 
     if kwargs:
diff --git a/tests/unit/modules/test_aptpkg.py 
b/tests/unit/modules/test_aptpkg.py
index ba1d874e69..b0193aeaf7 100644
--- a/tests/unit/modules/test_aptpkg.py
+++ b/tests/unit/modules/test_aptpkg.py
@@ -257,6 +257,23 @@ class AptPkgTestCase(TestCase, LoaderModuleMockMixin):
         self.assertEqual(aptpkg.info_installed('wget'), installed)
         self.assertEqual(len(aptpkg.info_installed()), 1)
 
+    def test_info_installed_attr_without_status(self):
+        '''
+        Test info_installed 'attr' for inclusion of 'status' attribute.
+
+        Since info_installed should only return installed packages, we need to
+        call __salt__['lowpkg.info'] with the 'status' attribute even if the 
user
+        is not asking for it in 'attr'. Otherwise info_installed would not be 
able
+        to check if the package is installed and would return everything.
+
+        :return:
+        '''
+        with patch('salt.modules.aptpkg.__salt__', {'lowpkg.info': 
MagicMock(return_value=LOWPKG_INFO)}) as wget_lowpkg:
+            ret = aptpkg.info_installed('wget', attr='version')
+            calls = wget_lowpkg['lowpkg.info'].call_args_list.pop()
+            self.assertIn('status', calls.kwargs['attr'])
+            self.assertIn('version', calls.kwargs['attr'])
+
     @patch('salt.modules.aptpkg.__salt__', {'lowpkg.info': 
MagicMock(return_value=LOWPKG_INFO)})
     def test_info_installed_attr(self):
         '''
-- 
2.27.0


++++++ opensuse-3000-libvirt-engine-fixes-251.patch ++++++
++++ 1340 lines (skipped)

++++++ opensuse-3000.3-spacewalk-runner-parse-command-250.patch ++++++
>From a7e1630d638a7e605a2372e923c0942c655480cd Mon Sep 17 00:00:00 2001
From: Jochen Breuer <[email protected]>
Date: Fri, 3 Jul 2020 14:08:03 +0200
Subject: [PATCH] openSUSE-3000.3 spacewalk runner parse command (#250)

* Accept nested namespaces in spacewalk.api

salt-run $server spacewalk.api allows users to run arbitrary Spacewalk
API functions through Salt. These are passed in a namespace.method
notation and may use nested namespaces. Previously only methods in a
top-level namespace were supported.

Fixes https://github.com/saltstack/salt/issues/57442

Co-authored-by: Wayne Werner <[email protected]>

* Add spacewalk runner command parsing tests

Co-authored-by: Alexander Graul <[email protected]>
Co-authored-by: Wayne Werner <[email protected]>
---
 changelog/57442.fixed                |  1 +
 salt/runners/spacewalk.py            |  6 +++-
 tests/unit/runners/test_spacewalk.py | 50 ++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+), 1 deletion(-)
 create mode 100644 changelog/57442.fixed
 create mode 100644 tests/unit/runners/test_spacewalk.py

diff --git a/changelog/57442.fixed b/changelog/57442.fixed
new file mode 100644
index 0000000000..81f394880f
--- /dev/null
+++ b/changelog/57442.fixed
@@ -0,0 +1 @@
+Accept nested namespaces in spacewalk.api runner function.
diff --git a/salt/runners/spacewalk.py b/salt/runners/spacewalk.py
index 07ca9bd711..df4e568a28 100644
--- a/salt/runners/spacewalk.py
+++ b/salt/runners/spacewalk.py
@@ -172,7 +172,11 @@ def api(server, command, *args, **kwargs):
         log.error(err_msg)
         return {call: err_msg}
 
-    namespace, method = command.split('.')
+    namespace, _, method = command.rpartition(".")
+    if not namespace:
+        return {
+            call: "Error: command must use the following format: 
'namespace.method'"
+        }
     endpoint = getattr(getattr(client, namespace), method)
 
     try:
diff --git a/tests/unit/runners/test_spacewalk.py 
b/tests/unit/runners/test_spacewalk.py
new file mode 100644
index 0000000000..5b64069cc9
--- /dev/null
+++ b/tests/unit/runners/test_spacewalk.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+"""
+Unit tests for Spacewalk runner
+"""
+import salt.runners.spacewalk as spacewalk
+from tests.support.mock import Mock, call, patch
+from tests.support.unit import TestCase
+
+
+class SpacewalkTest(TestCase):
+    """Test the Spacewalk runner"""
+
+    def test_api_command_must_have_namespace(self):
+        _get_session_mock = Mock(return_value=(None, None))
+
+        with patch.object(spacewalk, "_get_session", _get_session_mock):
+            result = spacewalk.api("mocked.server", "badMethod")
+            assert result == {
+                "badMethod ()": "Error: command must use the following format: 
'namespace.method'"
+            }
+
+    def test_api_command_accepts_single_namespace(self):
+        client_mock = Mock()
+        _get_session_mock = Mock(return_value=(client_mock, "key"))
+        getattr_mock = Mock(return_value="mocked_getattr_return")
+
+        with patch.object(spacewalk, "_get_session", _get_session_mock):
+            with patch.object(spacewalk, "getattr", getattr_mock):
+                spacewalk.api("mocked.server", "system.listSystems")
+                getattr_mock.assert_has_calls(
+                    [
+                        call(client_mock, "system"),
+                        call("mocked_getattr_return", "listSystems"),
+                    ]
+                )
+
+    def test_api_command_accepts_nested_namespace(self):
+        client_mock = Mock()
+        _get_session_mock = Mock(return_value=(client_mock, "key"))
+        getattr_mock = Mock(return_value="mocked_getattr_return")
+
+        with patch.object(spacewalk, "_get_session", _get_session_mock):
+            with patch.object(spacewalk, "getattr", getattr_mock):
+                spacewalk.api("mocked.server", "channel.software.listChildren")
+                getattr_mock.assert_has_calls(
+                    [
+                        call(client_mock, "channel.software"),
+                        call("mocked_getattr_return", "listChildren"),
+                    ]
+                )
-- 
2.27.0



Reply via email to