Hello community, here is the log from the commit of package salt for openSUSE:Factory checked in at 2020-03-19 19:47:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/salt (Old) and /work/SRC/openSUSE:Factory/.salt.new.3160 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "salt" Thu Mar 19 19:47:47 2020 rev:100 rq:786008 version:2019.2.3 Changes: -------- --- /work/SRC/openSUSE:Factory/salt/salt.changes 2020-03-08 22:22:29.116016296 +0100 +++ /work/SRC/openSUSE:Factory/.salt.new.3160/salt.changes 2020-03-19 19:50:31.432191888 +0100 @@ -1,0 +2,22 @@ +Tue Mar 17 10:35:25 UTC 2020 - Pablo Suárez Hernández <[email protected]> + +- virt._get_domain: don't raise an exception if there is no VM + +- Added: + * virt._get_domain-don-t-raise-an-exception-if-there-i.patch + +------------------------------------------------------------------- +Mon Mar 16 13:40:30 UTC 2020 - Jochen Breuer <[email protected]> + +- Adds test for zypper abbreviation fix +- Improved storage pool or network handling +- Better import cache handline + +- Added: + * loader-invalidate-the-import-cachefor-extra-modules.patch + * open-suse-2019.2.3-virt-defined-states-219.patch + +- Modified: + * use-full-option-name-instead-of-undocumented-abbrevi.patch + +------------------------------------------------------------------- New: ---- loader-invalidate-the-import-cachefor-extra-modules.patch open-suse-2019.2.3-virt-defined-states-219.patch virt._get_domain-don-t-raise-an-exception-if-there-i.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ salt.spec ++++++ --- /var/tmp/diff_new_pack.4S0UDo/_old 2020-03-19 19:50:34.876193877 +0100 +++ /var/tmp/diff_new_pack.4S0UDo/_new 2020-03-19 19:50:34.880193878 +0100 @@ -304,6 +304,13 @@ Patch111: fix-unit-tests-for-batch-async-after-refactor.patch # PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/218 Patch112: use-full-option-name-instead-of-undocumented-abbrevi.patch +# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/221 +Patch113: loader-invalidate-the-import-cachefor-extra-modules.patch +# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/55814 +Patch114: open-suse-2019.2.3-virt-defined-states-219.patch +# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/56392 +Patch115: virt._get_domain-don-t-raise-an-exception-if-there-i.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: logrotate @@ -942,6 +949,9 @@ %patch110 -p1 %patch111 -p1 %patch112 -p1 +%patch113 -p1 +%patch114 -p1 +%patch115 -p1 %build %if 0%{?build_py2} ++++++ _lastrevision ++++++ --- /var/tmp/diff_new_pack.4S0UDo/_old 2020-03-19 19:50:34.940193913 +0100 +++ /var/tmp/diff_new_pack.4S0UDo/_new 2020-03-19 19:50:34.944193915 +0100 @@ -1 +1 @@ -d9f16c8fe9224267baa7b315699270521dda6162 \ No newline at end of file +6c4669ed512eb32e435e4bfd2cebdcba315841bb \ No newline at end of file ++++++ loader-invalidate-the-import-cachefor-extra-modules.patch ++++++ >From 3d92c4e096dca27b95e485b70594186151e40092 Mon Sep 17 00:00:00 2001 From: Alberto Planas <[email protected]> Date: Thu, 12 Mar 2020 16:39:42 +0100 Subject: [PATCH] loader: invalidate the import cachefor extra modules Because we are mangling with importlib, we can find from time to time an invalidation issue with sys.path_importer_cache, that requires the removal of FileFinder that remain None for the extra_module_dirs (cherry picked from commit 0fb8e707a45d5caf40759e8b4943590d6fce5046) --- salt/loader.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/salt/loader.py b/salt/loader.py index 52cb4cfcb5..26b44de511 100644 --- a/salt/loader.py +++ b/salt/loader.py @@ -1506,9 +1506,11 @@ class LazyLoader(salt.utils.lazy.LazyDict): self._clean_module_dirs.append(directory) def __clean_sys_path(self): + invalidate_path_importer_cache = False for directory in self._clean_module_dirs: if directory in sys.path: sys.path.remove(directory) + invalidate_path_importer_cache = True self._clean_module_dirs = [] # Be sure that sys.path_importer_cache do not contains any @@ -1516,6 +1518,16 @@ class LazyLoader(salt.utils.lazy.LazyDict): if USE_IMPORTLIB: importlib.invalidate_caches() + # Because we are mangling with importlib, we can find from + # time to time an invalidation issue with + # sys.path_importer_cache, that requires the removal of + # FileFinder that remain None for the extra_module_dirs + if invalidate_path_importer_cache: + for directory in self.extra_module_dirs: + if directory in sys.path_importer_cache \ + and sys.path_importer_cache[directory] is None: + del sys.path_importer_cache[directory] + def _load_module(self, name): mod = None fpath, suffix = self.file_mapping[name][:2] -- 2.16.4 ++++++ open-suse-2019.2.3-virt-defined-states-219.patch ++++++ ++++ 2378 lines (skipped) ++++++ use-full-option-name-instead-of-undocumented-abbrevi.patch ++++++ --- /var/tmp/diff_new_pack.4S0UDo/_old 2020-03-19 19:50:35.308194126 +0100 +++ /var/tmp/diff_new_pack.4S0UDo/_new 2020-03-19 19:50:35.308194126 +0100 @@ -1,12 +1,13 @@ -From fb82c59e6de2a31f60c9f8a23f1eed4e24009dcf Mon Sep 17 00:00:00 2001 +From b06d2882f4e89011b1f5eeb442620b4543694140 Mon Sep 17 00:00:00 2001 From: Michael Calmer <[email protected]> Date: Sun, 1 Mar 2020 16:22:54 +0100 Subject: [PATCH] use full option name instead of undocumented abbreviation --- - salt/modules/zypperpkg.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + salt/modules/zypperpkg.py | 2 +- + tests/unit/modules/test_zypperpkg.py | 14 +++++++++++++- + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/salt/modules/zypperpkg.py b/salt/modules/zypperpkg.py index 8c1e05c21c..19d1fd96c7 100644 @@ -21,6 +22,38 @@ cmd.append('products') if not all: cmd.append('-i') +diff --git a/tests/unit/modules/test_zypperpkg.py b/tests/unit/modules/test_zypperpkg.py +index 7617113401..ae85152d30 100644 +--- a/tests/unit/modules/test_zypperpkg.py ++++ b/tests/unit/modules/test_zypperpkg.py +@@ -241,7 +241,18 @@ class ZypperTestCase(TestCase, LoaderModuleMockMixin): + 'stdout': get_test_data(filename) + } + +- with patch.dict(zypper.__salt__, {'cmd.run_all': MagicMock(return_value=ref_out)}): ++ cmd_run_all = MagicMock(return_value=ref_out) ++ mock_call = call(['zypper', ++ '--non-interactive', ++ '--xmlout', ++ '--no-refresh', ++ '--disable-repositories', ++ 'products', u'-i'], ++ env={'ZYPP_READONLY_HACK': '1'}, ++ output_loglevel='trace', ++ python_shell=False) ++ ++ with patch.dict(zypper.__salt__, {'cmd.run_all': cmd_run_all}): + products = zypper.list_products() + self.assertEqual(len(products), 7) + self.assertIn(test_data['vendor'], [product['vendor'] for product in products]) +@@ -250,6 +261,7 @@ class ZypperTestCase(TestCase, LoaderModuleMockMixin): + self.assertCountEqual(test_data[kwd], [prod.get(kwd) for prod in products]) + else: + self.assertEqual(test_data[kwd], sorted([prod.get(kwd) for prod in products])) ++ cmd_run_all.assert_has_calls([mock_call]) + + def test_refresh_db(self): + ''' -- 2.16.4 ++++++ virt._get_domain-don-t-raise-an-exception-if-there-i.patch ++++++ >From 9496d01c4ff7f20bfbff4902ae5c33c147a0343e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= <[email protected]> Date: Tue, 17 Mar 2020 11:01:48 +0100 Subject: [PATCH] virt._get_domain: don't raise an exception if there is no VM Raising an exception if there is no VM in _get_domain makes sense if looking for some VMs, but not when listing all VMs. --- salt/modules/virt.py | 2 +- tests/unit/modules/test_virt.py | 41 +++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/salt/modules/virt.py b/salt/modules/virt.py index b44d1a65bf97a363c2fe7a871e090cb9ca957e03..46a349ef98aa78483291dcafb38b4541bf0ac247 100644 --- a/salt/modules/virt.py +++ b/salt/modules/virt.py @@ -268,7 +268,7 @@ def _get_domain(conn, *vms, **kwargs): for id_ in conn.listDefinedDomains(): all_vms.append(id_) - if not all_vms: + if vms and not all_vms: raise CommandExecutionError('No virtual machines found.') if vms: diff --git a/tests/unit/modules/test_virt.py b/tests/unit/modules/test_virt.py index 2d3417ce91506a1819dbe03045a89887c9d19721..2696ed9d1bb892ee539b385e32393f8f98d23a30 100644 --- a/tests/unit/modules/test_virt.py +++ b/tests/unit/modules/test_virt.py @@ -3634,3 +3634,44 @@ class VirtTestCase(TestCase, LoaderModuleMockMixin): } }, [backend for backend in backends if backend['name'] == 'netfs'][0]['options']) + + def test_get_domain(self): + ''' + Test the virt._get_domain function + ''' + # Tests with no VM + self.mock_conn.listDomainsID.return_value = [] + self.mock_conn.listDefinedDomains.return_value = [] + self.assertEqual([], virt._get_domain(self.mock_conn)) + self.assertRaisesRegex(CommandExecutionError, 'No virtual machines found.', + virt._get_domain, self.mock_conn, 'vm2') + + # Test with active and inactive VMs + self.mock_conn.listDomainsID.return_value = [1] + + def create_mock_vm(idx): + mock_vm = MagicMock() + mock_vm.name.return_value = 'vm{0}'.format(idx) + return mock_vm + + mock_vms = [create_mock_vm(idx) for idx in range(3)] + self.mock_conn.lookupByID.return_value = mock_vms[0] + self.mock_conn.listDefinedDomains.return_value = ['vm1', 'vm2'] + + self.mock_conn.lookupByName.side_effect = mock_vms + self.assertEqual(mock_vms, virt._get_domain(self.mock_conn)) + + self.mock_conn.lookupByName.side_effect = None + self.mock_conn.lookupByName.return_value = mock_vms[0] + self.assertEqual(mock_vms[0], virt._get_domain(self.mock_conn, inactive=False)) + + self.mock_conn.lookupByName.return_value = None + self.mock_conn.lookupByName.side_effect = [mock_vms[1], mock_vms[2]] + self.assertEqual([mock_vms[1], mock_vms[2]], virt._get_domain(self.mock_conn, active=False)) + + self.mock_conn.reset_mock() + self.mock_conn.lookupByName.return_value = None + self.mock_conn.lookupByName.side_effect = [mock_vms[1], mock_vms[2]] + self.assertEqual([mock_vms[1], mock_vms[2]], virt._get_domain(self.mock_conn, 'vm1', 'vm2')) + self.assertRaisesRegex(CommandExecutionError, 'The VM "vm2" is not present', + virt._get_domain, self.mock_conn, 'vm2', inactive=False) -- 2.23.0
