dede5bd1d4
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=166
61 lines
2.5 KiB
Diff
61 lines
2.5 KiB
Diff
From c4742f553fe60aee82577622def1eeca0e2abf93 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
|
|
abbreviation
|
|
|
|
---
|
|
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 0c15214e5e..e3f802a911 100644
|
|
--- a/salt/modules/zypperpkg.py
|
|
+++ b/salt/modules/zypperpkg.py
|
|
@@ -2498,7 +2498,7 @@ def list_products(all=False, refresh=False, root=None):
|
|
OEM_PATH = os.path.join(root, os.path.relpath(OEM_PATH, os.path.sep))
|
|
cmd = list()
|
|
if not all:
|
|
- cmd.append('--disable-repos')
|
|
+ cmd.append('--disable-repositories')
|
|
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 76937cc358..2a8e753b9d 100644
|
|
--- a/tests/unit/modules/test_zypperpkg.py
|
|
+++ b/tests/unit/modules/test_zypperpkg.py
|
|
@@ -238,7 +238,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])
|
|
@@ -247,6 +258,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
|
|
|
|
|