Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP3:GA
salt.24749
handle-master-tops-data-when-states-are-applied...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File handle-master-tops-data-when-states-are-applied-by-t.patch of Package salt.24749
From 32d181866cd2352873f7c236d7e8762c6df2847d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?= <psuarezhernandez@suse.com> Date: Thu, 8 Jul 2021 08:57:13 +0100 Subject: [PATCH] Handle "master tops" data when states are applied by "transactional_update" (bsc#1187787) (#398) * Handle master tops data when states are applied by transactional_update (bsc#1187787) * Fix unit tests for transactional_update module --- salt/modules/transactional_update.py | 9 +++++++-- .../unit/modules/test_transactional_update.py | 20 +++++++++---------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/salt/modules/transactional_update.py b/salt/modules/transactional_update.py index 7bbdb697b8..9cdaddb91a 100644 --- a/salt/modules/transactional_update.py +++ b/salt/modules/transactional_update.py @@ -301,6 +301,11 @@ def __virtual__(): return (False, "Module transactional_update requires a transactional system") +class TransactionalUpdateHighstate(salt.client.ssh.state.SSHHighState): + def _master_tops(self): + return self.client.master_tops() + + def _global_params(self_update, snapshot=None, quiet=False): """Utility function to prepare common global parameters.""" params = ["--non-interactive", "--drop-if-no-change"] @@ -1107,7 +1112,7 @@ def sls( # Clone the options data and apply some default values. May not be # needed, as this module just delegate opts = salt.utils.state.get_sls_opts(__opts__, **kwargs) - st_ = salt.client.ssh.state.SSHHighState( + st_ = TransactionalUpdateHighstate( opts, pillar, __salt__, salt.fileclient.get_file_client(__opts__) ) @@ -1180,7 +1185,7 @@ def highstate(activate_transaction=False, **kwargs): # Clone the options data and apply some default values. May not be # needed, as this module just delegate opts = salt.utils.state.get_sls_opts(__opts__, **kwargs) - st_ = salt.client.ssh.state.SSHHighState( + st_ = TransactionalUpdateHighstate( opts, pillar, __salt__, salt.fileclient.get_file_client(__opts__) ) diff --git a/tests/unit/modules/test_transactional_update.py b/tests/unit/modules/test_transactional_update.py index 4616e0968f..0f356a1038 100644 --- a/tests/unit/modules/test_transactional_update.py +++ b/tests/unit/modules/test_transactional_update.py @@ -624,22 +624,22 @@ class TransactionalUpdateTestCase(TestCase, LoaderModuleMockMixin): utils_mock["files.rm_rf"].assert_called_once() @patch("salt.modules.transactional_update._create_and_execute_salt_state") - @patch("salt.client.ssh.state.SSHHighState") + @patch("salt.modules.transactional_update.TransactionalUpdateHighstate") @patch("salt.fileclient.get_file_client") @patch("salt.utils.state.get_sls_opts") def test_sls( self, get_sls_opts, get_file_client, - SSHHighState, + TransactionalUpdateHighstate, _create_and_execute_salt_state, ): """Test transactional_update.sls""" - SSHHighState.return_value = SSHHighState - SSHHighState.render_highstate.return_value = (None, []) - SSHHighState.state.reconcile_extend.return_value = (None, []) - SSHHighState.state.requisite_in.return_value = (None, []) - SSHHighState.state.verify_high.return_value = [] + TransactionalUpdateHighstate.return_value = TransactionalUpdateHighstate + TransactionalUpdateHighstate.render_highstate.return_value = (None, []) + TransactionalUpdateHighstate.state.reconcile_extend.return_value = (None, []) + TransactionalUpdateHighstate.state.requisite_in.return_value = (None, []) + TransactionalUpdateHighstate.state.verify_high.return_value = [] _create_and_execute_salt_state.return_value = "result" opts_mock = { @@ -651,18 +651,18 @@ class TransactionalUpdateTestCase(TestCase, LoaderModuleMockMixin): _create_and_execute_salt_state.assert_called_once() @patch("salt.modules.transactional_update._create_and_execute_salt_state") - @patch("salt.client.ssh.state.SSHHighState") + @patch("salt.modules.transactional_update.TransactionalUpdateHighstate") @patch("salt.fileclient.get_file_client") @patch("salt.utils.state.get_sls_opts") def test_highstate( self, get_sls_opts, get_file_client, - SSHHighState, + TransactionalUpdateHighstate, _create_and_execute_salt_state, ): """Test transactional_update.highstage""" - SSHHighState.return_value = SSHHighState + TransactionalUpdateHighstate.return_value = TransactionalUpdateHighstate _create_and_execute_salt_state.return_value = "result" opts_mock = { -- 2.32.0
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