2021-01-08 13:41:50 +01:00
|
|
|
From 421988aea296ced1f8c63cfa4b517b25eedfb00c Mon Sep 17 00:00:00 2001
|
2019-04-12 11:57:21 +02:00
|
|
|
From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= <cbosdonnat@suse.com>
|
|
|
|
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
|
2021-01-08 13:41:50 +01:00
|
|
|
index 6fa6e3e0a1..dfaaf420a1 100644
|
2019-04-12 11:57:21 +02:00
|
|
|
--- a/salt/modules/zypperpkg.py
|
|
|
|
+++ b/salt/modules/zypperpkg.py
|
2021-01-08 13:41:50 +01:00
|
|
|
@@ -300,7 +300,7 @@ class _Zypper:
|
2019-04-12 11:57:21 +02:00
|
|
|
self.__called = True
|
|
|
|
if self.__xml:
|
2021-01-08 13:41:50 +01:00
|
|
|
self.__cmd.append("--xmlout")
|
2019-04-12 11:57:21 +02:00
|
|
|
- if not self.__refresh:
|
2021-01-08 13:41:50 +01:00
|
|
|
+ if not self.__refresh and "--no-refresh" not in args:
|
|
|
|
self.__cmd.append("--no-refresh")
|
|
|
|
if self.__root:
|
|
|
|
self.__cmd.extend(["--root", self.__root])
|
2019-04-12 11:57:21 +02:00
|
|
|
diff --git a/tests/unit/modules/test_zypperpkg.py b/tests/unit/modules/test_zypperpkg.py
|
2021-01-08 13:41:50 +01:00
|
|
|
index 7bff7065c6..b07f9a3af7 100644
|
2019-04-12 11:57:21 +02:00
|
|
|
--- a/tests/unit/modules/test_zypperpkg.py
|
|
|
|
+++ b/tests/unit/modules/test_zypperpkg.py
|
2021-01-08 13:41:50 +01:00
|
|
|
@@ -136,7 +136,7 @@ class ZypperTestCase(TestCase, LoaderModuleMockMixin):
|
|
|
|
self.assertEqual(zypper.__zypper__.call("foo"), stdout_xml_snippet)
|
2019-04-12 11:57:21 +02:00
|
|
|
self.assertEqual(len(sniffer.calls), 1)
|
|
|
|
|
2021-01-08 13:41:50 +01:00
|
|
|
- zypper.__zypper__.call("bar")
|
|
|
|
+ zypper.__zypper__.call("--no-refresh", "bar")
|
2019-04-12 11:57:21 +02:00
|
|
|
self.assertEqual(len(sniffer.calls), 2)
|
2021-01-08 13:41:50 +01:00
|
|
|
self.assertEqual(
|
|
|
|
sniffer.calls[0]["args"][0],
|
2019-04-12 11:57:21 +02:00
|
|
|
--
|
2021-01-08 13:41:50 +01:00
|
|
|
2.29.2
|
2019-04-12 11:57:21 +02:00
|
|
|
|
|
|
|
|