Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
salt.8148
fix-openscap-push.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fix-openscap-push.patch of Package salt.8148
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
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor