Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:Update
salt.26880
support-transactional-systems-microos.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File support-transactional-systems-microos.patch of Package salt.26880
From 5d7b9be571b765faae5cefc5a0810c61c2a25814 Mon Sep 17 00:00:00 2001 From: Alexander Graul <agraul@suse.com> Date: Tue, 18 Jan 2022 17:36:12 +0100 Subject: [PATCH] Support transactional systems (MicroOS) Add rebootmgr module Add transactional_update module chroot: add chroot detector systemd: add offline mode detector transactional_update: add pending_transaction detector extra: add EFI and transactional grains transactional_update: add call, apply_, sls & highstate transactional_update: add documentation transactional_update: add executor Add changelog entry 58519.added Closes #58519 transactional_update: update the cleanups family transactional_update: add activate_transaction param transactional_update: skip tests on Windows transactional_update: unify with chroot.call Return for both .call() "retcode" when fail Add MicroOS information in release note systemd: support NamedLoaderContext transactional_update: detect recursion in the executor Handle master tops data when states are applied by transactional_update Fix unit tests for transactional_update module Do noop for services states when running systemd in offline mode transactional_updates: do not execute states in parallel but use a queue Add changes suggested by pre-commit Fix unit tests for transactional_updates module Add unit tests to cover queue cases on transaction_update states Refactor offline checkers and add unit tests Fix regression that always consider offline mode Add proper mocking and skip tests when running in offline mode Fix failing unit tests for systemd test_rebootmgr: convert to pytest test_transactional_update: convert to pytest Update release documentation to 3004 --- changelog/58519.added | 1 + salt/modules/chroot.py | 10 +++++++--- salt/modules/transactional_update.py | 8 ++++---- .../unit/modules/test_transactional_update.py | 10 +++++++++- tests/unit/modules/test_chroot.py | 13 ++++++++++++- 5 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 changelog/58519.added diff --git a/changelog/58519.added b/changelog/58519.added new file mode 100644 index 0000000000..1cc8d7dc74 --- /dev/null +++ b/changelog/58519.added @@ -0,0 +1 @@ +Add support for transactional systems, like openSUSE MicroOS \ No newline at end of file diff --git a/salt/modules/chroot.py b/salt/modules/chroot.py index 39dfff6b86..91f139455b 100644 --- a/salt/modules/chroot.py +++ b/salt/modules/chroot.py @@ -242,7 +242,11 @@ def _create_and_execute_salt_state(root, chunks, file_refs, test, hash_type): # Create the tar containing the state pkg and relevant files. salt.client.ssh.wrapper.state._cleanup_slsmod_low_data(chunks) trans_tar = salt.client.ssh.state.prep_trans_tar( - salt.fileclient.get_file_client(__opts__), chunks, file_refs, __pillar__, root + salt.fileclient.get_file_client(__opts__), + chunks, + file_refs, + __pillar__.value(), + root, ) trans_tar_sum = salt.utils.hashutils.get_hash(trans_tar, hash_type) @@ -303,7 +307,7 @@ def sls(root, mods, saltenv="base", test=None, exclude=None, **kwargs): """ # Get a copy of the pillar data, to avoid overwriting the current # pillar, instead the one delegated - pillar = copy.deepcopy(__pillar__) + pillar = copy.deepcopy(__pillar__.value()) pillar.update(kwargs.get("pillar", {})) # Clone the options data and apply some default values. May not be @@ -372,7 +376,7 @@ def highstate(root, **kwargs): """ # Get a copy of the pillar data, to avoid overwriting the current # pillar, instead the one delegated - pillar = copy.deepcopy(__pillar__) + pillar = copy.deepcopy(__pillar__.value()) pillar.update(kwargs.get("pillar", {})) # Clone the options data and apply some default values. May not be diff --git a/salt/modules/transactional_update.py b/salt/modules/transactional_update.py index 6fcad40b35..799fe08e4d 100644 --- a/salt/modules/transactional_update.py +++ b/salt/modules/transactional_update.py @@ -1052,7 +1052,7 @@ def _create_and_execute_salt_state( # Create the tar containing the state pkg and relevant files. salt.client.ssh.wrapper.state._cleanup_slsmod_low_data(chunks) trans_tar = salt.client.ssh.state.prep_trans_tar( - salt.fileclient.get_file_client(__opts__), chunks, file_refs, __pillar__ + salt.fileclient.get_file_client(__opts__), chunks, file_refs, __pillar__.value() ) trans_tar_sum = salt.utils.hashutils.get_hash(trans_tar, hash_type) @@ -1134,7 +1134,7 @@ def sls( # Get a copy of the pillar data, to avoid overwriting the current # pillar, instead the one delegated - pillar = copy.deepcopy(__pillar__) + pillar = copy.deepcopy(__pillar__.value()) pillar.update(kwargs.get("pillar", {})) # Clone the options data and apply some default values. May not be @@ -1218,7 +1218,7 @@ def highstate(activate_transaction=False, queue=False, **kwargs): # Get a copy of the pillar data, to avoid overwriting the current # pillar, instead the one delegated - pillar = copy.deepcopy(__pillar__) + pillar = copy.deepcopy(__pillar__.value()) pillar.update(kwargs.get("pillar", {})) # Clone the options data and apply some default values. May not be @@ -1284,7 +1284,7 @@ def single(fun, name, test=None, activate_transaction=False, queue=False, **kwar # Get a copy of the pillar data, to avoid overwriting the current # pillar, instead the one delegated - pillar = copy.deepcopy(__pillar__) + pillar = copy.deepcopy(__pillar__.value()) pillar.update(kwargs.get("pillar", {})) # Clone the options data and apply some default values. May not be diff --git a/tests/pytests/unit/modules/test_transactional_update.py b/tests/pytests/unit/modules/test_transactional_update.py index f9eb1fd595..032ca0c9e8 100644 --- a/tests/pytests/unit/modules/test_transactional_update.py +++ b/tests/pytests/unit/modules/test_transactional_update.py @@ -1,6 +1,7 @@ import sys import pytest +import salt.loader.context import salt.modules.state as statemod import salt.modules.transactional_update as tu from salt.exceptions import CommandExecutionError @@ -13,8 +14,15 @@ pytestmark = [ @pytest.fixture def configure_loader_modules(): + loader_context = salt.loader.context.LoaderContext() return { - tu: {"__salt__": {}, "__utils__": {}}, + tu: { + "__salt__": {}, + "__utils__": {}, + "__pillar__": salt.loader.context.NamedLoaderContext( + "__pillar__", loader_context, {} + ), + }, statemod: {"__salt__": {}, "__context__": {}}, } diff --git a/tests/unit/modules/test_chroot.py b/tests/unit/modules/test_chroot.py index cdbfcb0fab..9cdfeaf066 100644 --- a/tests/unit/modules/test_chroot.py +++ b/tests/unit/modules/test_chroot.py @@ -27,6 +27,7 @@ import sys +import salt.loader.context import salt.modules.chroot as chroot import salt.utils.platform from salt.exceptions import CommandExecutionError @@ -42,7 +43,17 @@ class ChrootTestCase(TestCase, LoaderModuleMockMixin): """ def setup_loader_modules(self): - return {chroot: {"__salt__": {}, "__utils__": {}, "__opts__": {"cachedir": ""}}} + loader_context = salt.loader.context.LoaderContext() + return { + chroot: { + "__salt__": {}, + "__utils__": {}, + "__opts__": {"cachedir": ""}, + "__pillar__": salt.loader.context.NamedLoaderContext( + "__pillar__", loader_context, {} + ), + } + } @patch("os.path.isdir") def test_exist(self, isdir): -- 2.34.1
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