From 421988aea296ced1f8c63cfa4b517b25eedfb00c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Date: Tue, 29 Jan 2019 09:44:03 +0100 Subject: [PATCH] Don't call zypper with more than one --no-refresh Now zypper started being picky and errors out when --no-refresh is passed twice. Make sure we won't hit this. --- salt/modules/zypperpkg.py | 2 +- tests/unit/modules/test_zypperpkg.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/salt/modules/zypperpkg.py b/salt/modules/zypperpkg.py index 6fa6e3e0a1..dfaaf420a1 100644 --- a/salt/modules/zypperpkg.py +++ b/salt/modules/zypperpkg.py @@ -300,7 +300,7 @@ class _Zypper: self.__called = True if self.__xml: self.__cmd.append("--xmlout") - if not self.__refresh: + if not self.__refresh and "--no-refresh" not in args: self.__cmd.append("--no-refresh") if self.__root: self.__cmd.extend(["--root", self.__root]) diff --git a/tests/unit/modules/test_zypperpkg.py b/tests/unit/modules/test_zypperpkg.py index 7bff7065c6..b07f9a3af7 100644 --- a/tests/unit/modules/test_zypperpkg.py +++ b/tests/unit/modules/test_zypperpkg.py @@ -136,7 +136,7 @@ class ZypperTestCase(TestCase, LoaderModuleMockMixin): self.assertEqual(zypper.__zypper__.call("foo"), stdout_xml_snippet) self.assertEqual(len(sniffer.calls), 1) - zypper.__zypper__.call("bar") + zypper.__zypper__.call("--no-refresh", "bar") self.assertEqual(len(sniffer.calls), 2) self.assertEqual( sniffer.calls[0]["args"][0], -- 2.29.2