SHA256
1
0
forked from pool/salt
salt/fix-openscap-push.patch
Klaus Kämpf aeed45986b Accepting request 594031 from systemsmanagement:saltstack:testing
- Update to 2018.3.0
- Modified:
  * explore-module.run-response-to-catch-the-result-in-d.patch
  * add-saltssh-multi-version-support-across-python-inte.patch
  * run-salt-api-as-user-salt-bsc-1064520.patch
  * fix-openscap-push.patch
  * fix-decrease-loglevel-when-unable-to-resolve-addr.patch
  * fix-cp.push-empty-file.patch
  * make-it-possible-to-use-login-pull-and-push-from-mod.patch
  * avoid-excessive-syslogging-by-watchdog-cronjob-58.patch
  * feat-add-grain-for-all-fqdns.patch
  * fix-bsc-1065792.patch
  * run-salt-master-as-dedicated-salt-user.patch
  * move-log_file-option-to-changeable-defaults.patch
  * activate-all-beacons-sources-config-pillar-grains.patch
  * remove-obsolete-unicode-handling-in-pkg.info_install.patch

                                                                                    
- Add python-2.6 support to salt-ssh
- Modified:
  * add-saltssh-multi-version-support-across-python-inte.patch

                                                                                    
- Update salt-ssh multiversion patch
- Modified:
  * add-saltssh-multi-version-support-across-python-inte.patch
- Removed:
  * require-same-major-version-while-minor-is-allowed-to.patch

OBS-URL: https://build.opensuse.org/request/show/594031
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=117
2018-04-11 16:47:08 +00:00

73 lines
2.7 KiB
Diff

From 589d90117783a126dce695cf76a3b8fc2953f8b6 Mon Sep 17 00:00:00 2001
From: Mihai Dinca <mdinca@suse.de>
Date: Fri, 2 Mar 2018 17:17:58 +0100
Subject: [PATCH] Fix openscap push
---
salt/modules/openscap.py | 4 +---
tests/unit/modules/test_openscap.py | 10 +++++-----
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/salt/modules/openscap.py b/salt/modules/openscap.py
index c5b51a1846..e3190e1e11 100644
--- a/salt/modules/openscap.py
+++ b/salt/modules/openscap.py
@@ -13,7 +13,6 @@ from subprocess import Popen, PIPE
# Import Salt libs
from salt.ext import six
-from salt.client import Caller
ArgumentParser = object
@@ -105,8 +104,7 @@ def xccdf(params):
success = _OSCAP_EXIT_CODES_MAP[proc.returncode]
returncode = proc.returncode
if success:
- caller = Caller()
- caller.cmd('cp.push_dir', tempdir)
+ __salt__['cp.push_dir'](tempdir)
shutil.rmtree(tempdir, ignore_errors=True)
upload_dir = tempdir
diff --git a/tests/unit/modules/test_openscap.py b/tests/unit/modules/test_openscap.py
index eb8ad1225b..6e17148de1 100644
--- a/tests/unit/modules/test_openscap.py
+++ b/tests/unit/modules/test_openscap.py
@@ -28,8 +28,10 @@ class OpenscapTestCase(TestCase):
policy_file = '/usr/share/openscap/policy-file-xccdf.xml'
def setUp(self):
+ import salt.modules.openscap
+ salt.modules.openscap.__salt__ = MagicMock()
patchers = [
- patch('salt.modules.openscap.Caller', MagicMock()),
+ patch('salt.modules.openscap.__salt__', MagicMock()),
patch('salt.modules.openscap.shutil.rmtree', Mock()),
patch(
'salt.modules.openscap.tempfile.mkdtemp',
@@ -68,8 +70,7 @@ class OpenscapTestCase(TestCase):
cwd=openscap.tempfile.mkdtemp.return_value,
stderr=PIPE,
stdout=PIPE)
- openscap.Caller().cmd.assert_called_once_with(
- 'cp.push_dir', self.random_temp_dir)
+ openscap.__salt__['cp.push_dir'].assert_called_once_with(self.random_temp_dir)
self.assertEqual(openscap.shutil.rmtree.call_count, 1)
self.assertEqual(
response,
@@ -106,8 +107,7 @@ class OpenscapTestCase(TestCase):
cwd=openscap.tempfile.mkdtemp.return_value,
stderr=PIPE,
stdout=PIPE)
- openscap.Caller().cmd.assert_called_once_with(
- 'cp.push_dir', self.random_temp_dir)
+ openscap.__salt__['cp.push_dir'].assert_called_once_with(self.random_temp_dir)
self.assertEqual(openscap.shutil.rmtree.call_count, 1)
self.assertEqual(
response,
--
2.16.2