2020-04-07 14:14:01 +02:00
|
|
|
From 29316e1e73972d7c30a7b125a27198fefc6b2fd7 Mon Sep 17 00:00:00 2001
|
2019-10-10 13:49:11 +02:00
|
|
|
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
|
|
|
|
<psuarezhernandez@suse.com>
|
|
|
|
Date: Mon, 30 Sep 2019 12:06:08 +0100
|
|
|
|
Subject: [PATCH] Prevent systemd-run description issue when running
|
|
|
|
aptpkg (bsc#1152366)
|
|
|
|
|
|
|
|
---
|
|
|
|
salt/modules/aptpkg.py | 2 +-
|
|
|
|
tests/unit/modules/test_aptpkg.py | 2 +-
|
|
|
|
2 files changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/salt/modules/aptpkg.py b/salt/modules/aptpkg.py
|
2020-04-07 14:14:01 +02:00
|
|
|
index bafad40efe..2835d32263 100644
|
2019-10-10 13:49:11 +02:00
|
|
|
--- a/salt/modules/aptpkg.py
|
|
|
|
+++ b/salt/modules/aptpkg.py
|
2020-04-07 14:14:01 +02:00
|
|
|
@@ -168,7 +168,7 @@ def _call_apt(args, scope=True, **kwargs):
|
2019-10-10 13:49:11 +02:00
|
|
|
'''
|
|
|
|
cmd = []
|
|
|
|
if scope and salt.utils.systemd.has_scope(__context__) and __salt__['config.get']('systemd.scope', True):
|
|
|
|
- cmd.extend(['systemd-run', '--scope', '--description "{0}"'.format(__name__)])
|
|
|
|
+ cmd.extend(['systemd-run', '--scope', '--description', '"{0}"'.format(__name__)])
|
|
|
|
cmd.extend(args)
|
|
|
|
|
|
|
|
params = {'output_loglevel': 'trace',
|
|
|
|
diff --git a/tests/unit/modules/test_aptpkg.py b/tests/unit/modules/test_aptpkg.py
|
2020-04-07 14:14:01 +02:00
|
|
|
index 88eed062c4..2224aba9a1 100644
|
2019-10-10 13:49:11 +02:00
|
|
|
--- a/tests/unit/modules/test_aptpkg.py
|
|
|
|
+++ b/tests/unit/modules/test_aptpkg.py
|
2020-04-07 14:14:01 +02:00
|
|
|
@@ -645,7 +645,7 @@ class AptUtilsTestCase(TestCase, LoaderModuleMockMixin):
|
2019-10-10 13:49:11 +02:00
|
|
|
with patch.dict(aptpkg.__salt__, {'cmd.run_all': MagicMock(), 'config.get': MagicMock(return_value=True)}):
|
|
|
|
aptpkg._call_apt(['apt-get', 'purge', 'vim']) # pylint: disable=W0106
|
|
|
|
aptpkg.__salt__['cmd.run_all'].assert_called_once_with(
|
|
|
|
- ['systemd-run', '--scope', '--description "salt.modules.aptpkg"', 'apt-get', 'purge', 'vim'], env={},
|
|
|
|
+ ['systemd-run', '--scope', '--description', '"salt.modules.aptpkg"', 'apt-get', 'purge', 'vim'], env={},
|
|
|
|
output_loglevel='trace', python_shell=False)
|
|
|
|
|
|
|
|
def test_call_apt_with_kwargs(self):
|
|
|
|
--
|
2019-11-28 16:41:55 +01:00
|
|
|
2.16.4
|
2019-10-10 13:49:11 +02:00
|
|
|
|
|
|
|
|