65598582f5
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=179
84 lines
3.1 KiB
Diff
84 lines
3.1 KiB
Diff
From 7b2b5fc53d30397b8f7a11e59f5c7a57bcb63058 Mon Sep 17 00:00:00 2001
|
|
From: Marcelo Chiaradia <mchiaradia@suse.com>
|
|
Date: Thu, 7 Jun 2018 10:29:41 +0200
|
|
Subject: [PATCH] Add environment variable to know if yum is invoked
|
|
from Salt(bsc#1057635)
|
|
|
|
---
|
|
salt/modules/yumpkg.py | 23 +++++++++++++++++------
|
|
1 file changed, 17 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/salt/modules/yumpkg.py b/salt/modules/yumpkg.py
|
|
index b547fe6be7..c58b3e4c70 100644
|
|
--- a/salt/modules/yumpkg.py
|
|
+++ b/salt/modules/yumpkg.py
|
|
@@ -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):
|
|
"""
|
|
_check_versionlock()
|
|
|
|
- out = __salt__["cmd.run"]([_yum(), "versionlock", "list"], python_shell=False)
|
|
+ out = __salt__["cmd.run"](
|
|
+ [_yum(), "versionlock", "list"], python_shell=False, env={"SALT_RUNNING": "1"}
|
|
+ )
|
|
ret = []
|
|
for line in salt.utils.itertools.split(out, "\n"):
|
|
match = _get_hold(line, pattern=pattern, full=full)
|
|
@@ -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",
|
|
+ python_shell=False,
|
|
+ env={"SALT_RUNNING": "1"},
|
|
)
|
|
key = None
|
|
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"}
|
|
+ )
|
|
|
|
g_info = {}
|
|
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"}
|
|
+ )
|
|
ret = {}
|
|
for dld_result in os.listdir(CACHE_DIR):
|
|
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"})
|
|
for line in salt.utils.itertools.split(ret, os.linesep):
|
|
inst, advisory_id, sev, pkg = re.match(
|
|
r"([i|\s]) ([^\s]+) +([^\s]+) +([^\s]+)", line
|
|
--
|
|
2.29.2
|
|
|
|
|