2023-05-05 11:15:58 +02:00
|
|
|
From d7682d1bc67ccdd63022c63b2d3229f8ab40d52b Mon Sep 17 00:00:00 2001
|
2022-01-27 16:38:33 +01:00
|
|
|
From: Alexander Graul <agraul@suse.com>
|
|
|
|
Date: Tue, 18 Jan 2022 12:57:21 +0100
|
|
|
|
Subject: [PATCH] Add environment variable to know if yum is invoked from
|
|
|
|
Salt(bsc#1057635)
|
2018-07-30 13:52:13 +02:00
|
|
|
|
|
|
|
---
|
2021-01-08 13:41:50 +01:00
|
|
|
salt/modules/yumpkg.py | 23 +++++++++++++++++------
|
|
|
|
1 file changed, 17 insertions(+), 6 deletions(-)
|
2018-07-30 13:52:13 +02:00
|
|
|
|
|
|
|
diff --git a/salt/modules/yumpkg.py b/salt/modules/yumpkg.py
|
2023-05-05 11:15:58 +02:00
|
|
|
index 4d0070f21a..b362d30bf4 100644
|
2018-07-30 13:52:13 +02:00
|
|
|
--- a/salt/modules/yumpkg.py
|
|
|
|
+++ b/salt/modules/yumpkg.py
|
2023-05-05 11:15:58 +02:00
|
|
|
@@ -964,7 +964,9 @@ def list_repo_pkgs(*args, **kwargs):
|
2021-01-08 13:41:50 +01:00
|
|
|
None
|
|
|
|
if _yum() != "yum"
|
2023-05-05 11:15:58 +02:00
|
|
|
else LooseVersion(
|
2021-01-08 13:41:50 +01:00
|
|
|
- __salt__["cmd.run"](["yum", "--version"], python_shell=False)
|
|
|
|
+ __salt__["cmd.run"](
|
|
|
|
+ ["yum", "--version"], python_shell=False, env={"SALT_RUNNING": "1"}
|
|
|
|
+ )
|
|
|
|
.splitlines()[0]
|
|
|
|
.strip()
|
|
|
|
)
|
2023-05-05 11:15:58 +02:00
|
|
|
@@ -2474,7 +2476,9 @@ def list_holds(pattern=__HOLD_PATTERN, full=True):
|
2021-01-08 13:41:50 +01:00
|
|
|
"""
|
2018-07-30 13:52:13 +02:00
|
|
|
_check_versionlock()
|
|
|
|
|
2021-01-08 13:41:50 +01:00
|
|
|
- out = __salt__["cmd.run"]([_yum(), "versionlock", "list"], python_shell=False)
|
|
|
|
+ out = __salt__["cmd.run"](
|
|
|
|
+ [_yum(), "versionlock", "list"], python_shell=False, env={"SALT_RUNNING": "1"}
|
|
|
|
+ )
|
2018-07-30 13:52:13 +02:00
|
|
|
ret = []
|
2021-01-08 13:41:50 +01:00
|
|
|
for line in salt.utils.itertools.split(out, "\n"):
|
2018-07-30 13:52:13 +02:00
|
|
|
match = _get_hold(line, pattern=pattern, full=full)
|
2023-05-05 11:15:58 +02:00
|
|
|
@@ -2542,7 +2546,10 @@ def group_list():
|
2021-01-08 13:41:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
out = __salt__["cmd.run_stdout"](
|
|
|
|
- [_yum(), "grouplist", "hidden"], output_loglevel="trace", python_shell=False
|
|
|
|
+ [_yum(), "grouplist", "hidden"],
|
|
|
|
+ output_loglevel="trace",
|
2018-07-30 13:52:13 +02:00
|
|
|
+ python_shell=False,
|
2021-01-08 13:41:50 +01:00
|
|
|
+ env={"SALT_RUNNING": "1"},
|
2018-07-30 13:52:13 +02:00
|
|
|
)
|
|
|
|
key = None
|
2021-01-08 13:41:50 +01:00
|
|
|
for line in salt.utils.itertools.split(out, "\n"):
|
2023-05-05 11:15:58 +02:00
|
|
|
@@ -2613,7 +2620,9 @@ def group_info(name, expand=False, ignore_groups=None):
|
2021-01-08 13:41:50 +01:00
|
|
|
ret[pkgtype] = set()
|
|
|
|
|
|
|
|
cmd = [_yum(), "--quiet", "groupinfo", name]
|
|
|
|
- out = __salt__["cmd.run_stdout"](cmd, output_loglevel="trace", python_shell=False)
|
|
|
|
+ out = __salt__["cmd.run_stdout"](
|
|
|
|
+ cmd, output_loglevel="trace", python_shell=False, env={"SALT_RUNNING": "1"}
|
|
|
|
+ )
|
2018-07-30 13:52:13 +02:00
|
|
|
|
|
|
|
g_info = {}
|
2021-01-08 13:41:50 +01:00
|
|
|
for line in salt.utils.itertools.split(out, "\n"):
|
2023-05-05 11:15:58 +02:00
|
|
|
@@ -3342,7 +3351,9 @@ def download(*packages, **kwargs):
|
2021-01-08 13:41:50 +01:00
|
|
|
|
|
|
|
cmd = ["yumdownloader", "-q", "--destdir={}".format(CACHE_DIR)]
|
|
|
|
cmd.extend(packages)
|
|
|
|
- __salt__["cmd.run"](cmd, output_loglevel="trace", python_shell=False)
|
|
|
|
+ __salt__["cmd.run"](
|
|
|
|
+ cmd, output_loglevel="trace", python_shell=False, env={"SALT_RUNNING": "1"}
|
|
|
|
+ )
|
2018-07-30 13:52:13 +02:00
|
|
|
ret = {}
|
|
|
|
for dld_result in os.listdir(CACHE_DIR):
|
2021-01-08 13:41:50 +01:00
|
|
|
if not dld_result.endswith(".rpm"):
|
2023-05-05 11:15:58 +02:00
|
|
|
@@ -3418,7 +3429,7 @@ def _get_patches(installed_only=False):
|
2021-01-08 13:41:50 +01:00
|
|
|
patches = {}
|
|
|
|
|
|
|
|
cmd = [_yum(), "--quiet", "updateinfo", "list", "all"]
|
|
|
|
- ret = __salt__["cmd.run_stdout"](cmd, python_shell=False)
|
|
|
|
+ ret = __salt__["cmd.run_stdout"](cmd, python_shell=False, env={"SALT_RUNNING": "1"})
|
2022-01-27 16:38:33 +01:00
|
|
|
parsing_errors = False
|
|
|
|
|
2018-07-30 13:52:13 +02:00
|
|
|
for line in salt.utils.itertools.split(ret, os.linesep):
|
|
|
|
--
|
2023-05-05 11:15:58 +02:00
|
|
|
2.39.2
|
2018-07-30 13:52:13 +02:00
|
|
|
|
|
|
|
|