2021-01-08 13:41:50 +01:00
|
|
|
From 7b2b5fc53d30397b8f7a11e59f5c7a57bcb63058 Mon Sep 17 00:00:00 2001
|
2018-07-30 13:52:13 +02:00
|
|
|
From: Marcelo Chiaradia <mchiaradia@suse.com>
|
|
|
|
Date: Thu, 7 Jun 2018 10:29:41 +0200
|
2021-01-08 13:41:50 +01:00
|
|
|
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
|
2021-01-08 13:41:50 +01:00
|
|
|
index b547fe6be7..c58b3e4c70 100644
|
2018-07-30 13:52:13 +02:00
|
|
|
--- a/salt/modules/yumpkg.py
|
|
|
|
+++ b/salt/modules/yumpkg.py
|
2021-01-08 13:41:50 +01:00
|
|
|
@@ -917,7 +917,9 @@ def list_repo_pkgs(*args, **kwargs):
|
|
|
|
None
|
|
|
|
if _yum() != "yum"
|
|
|
|
else _LooseVersion(
|
|
|
|
- __salt__["cmd.run"](["yum", "--version"], python_shell=False)
|
|
|
|
+ __salt__["cmd.run"](
|
|
|
|
+ ["yum", "--version"], python_shell=False, env={"SALT_RUNNING": "1"}
|
|
|
|
+ )
|
|
|
|
.splitlines()[0]
|
|
|
|
.strip()
|
|
|
|
)
|
|
|
|
@@ -2347,7 +2349,9 @@ def list_holds(pattern=__HOLD_PATTERN, full=True):
|
|
|
|
"""
|
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)
|
2021-01-08 13:41:50 +01:00
|
|
|
@@ -2415,7 +2419,10 @@ def group_list():
|
|
|
|
}
|
|
|
|
|
|
|
|
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"):
|
|
|
|
@@ -2486,7 +2493,9 @@ def group_info(name, expand=False, ignore_groups=None):
|
|
|
|
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"):
|
|
|
|
@@ -3203,7 +3212,9 @@ def download(*packages, **kwargs):
|
|
|
|
|
|
|
|
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"):
|
|
|
|
@@ -3279,7 +3290,7 @@ def _get_patches(installed_only=False):
|
|
|
|
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"})
|
2018-07-30 13:52:13 +02:00
|
|
|
for line in salt.utils.itertools.split(ret, os.linesep):
|
2021-01-08 13:41:50 +01:00
|
|
|
inst, advisory_id, sev, pkg = re.match(
|
|
|
|
r"([i|\s]) ([^\s]+) +([^\s]+) +([^\s]+)", line
|
2018-07-30 13:52:13 +02:00
|
|
|
--
|
2021-01-08 13:41:50 +01:00
|
|
|
2.29.2
|
2018-07-30 13:52:13 +02:00
|
|
|
|
|
|
|
|