osc copypac from project:systemsmanagement:saltstack:testing package:salt revision:327

OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=163
This commit is contained in:
Jochen Breuer 2020-03-16 15:06:32 +00:00 committed by Git OBS Bridge
parent f6d75f9808
commit 99b0017700
6 changed files with 2488 additions and 4 deletions

View File

@ -1 +1 @@
d9f16c8fe9224267baa7b315699270521dda6162
0f35901e836e26f224b8fe278679334f6ea6281d

View File

@ -0,0 +1,52 @@
From 3d92c4e096dca27b95e485b70594186151e40092 Mon Sep 17 00:00:00 2001
From: Alberto Planas <aplanas@suse.com>
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

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Mon Mar 16 13:40:30 UTC 2020 - Jochen Breuer <jbreuer@suse.de>
- 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
-------------------------------------------------------------------
Thu Mar 5 12:12:35 UTC 2020 - Jochen Breuer <jbreuer@suse.de>

View File

@ -304,6 +304,11 @@ Patch110: batch-async-catch-exceptions-and-safety-unregister-a.patch
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
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: logrotate
@ -942,6 +947,8 @@ cp %{S:5} ./.travis.yml
%patch110 -p1
%patch111 -p1
%patch112 -p1
%patch113 -p1
%patch114 -p1
%build
%if 0%{?build_py2}

View File

@ -1,4 +1,4 @@
From fb82c59e6de2a31f60c9f8a23f1eed4e24009dcf Mon Sep 17 00:00:00 2001
From b06d2882f4e89011b1f5eeb442620b4543694140 Mon Sep 17 00:00:00 2001
From: Michael Calmer <mc@suse.de>
Date: Sun, 1 Mar 2020 16:22:54 +0100
Subject: [PATCH] use full option name instead of undocumented
@ -6,7 +6,8 @@ Subject: [PATCH] use full option name instead of undocumented
---
salt/modules/zypperpkg.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 @@ index 8c1e05c21c..19d1fd96c7 100644
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