Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Transactional update module prevents sls execution #575

Closed
1 task done
rdouman opened this issue Jan 31, 2023 · 4 comments · Fixed by #582
Closed
1 task done

[BUG] Transactional update module prevents sls execution #575

rdouman opened this issue Jan 31, 2023 · 4 comments · Fixed by #582

Comments

@rdouman
Copy link

rdouman commented Jan 31, 2023

Description
When invoking salt commands: salt '*' state.apply I receive the stack trace below:

   The minion function caused an exception: Traceback (most recent call last):
      File "/usr/lib/python3.10/site-packages/salt/minion.py", line 1939, in _thread_return
        return_data = minion_instance._execute_job_function(
      File "/usr/lib/python3.10/site-packages/salt/minion.py", line 1898, in _execute_job_function
        return_data = self.executors[fname](opts, data, func, args, kwargs)
      File "/usr/lib/python3.10/site-packages/salt/loader/lazy.py", line 149, in __call__
        return self.loader.run(run_func, *args, **kwargs)
      File "/usr/lib/python3.10/site-packages/salt/loader/lazy.py", line 1230, in run
        return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
      File "/usr/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in _run_as
        return _func_or_method(*args, **kwargs)
      File "/usr/lib/python3.10/site-packages/salt/executors/transactional_update.py", line 123, in execute
        opts, data, __salt__[DELEGATION_MAP[fun]], args, kwargs
      File "/usr/lib/python3.10/site-packages/salt/loader/context.py", line 78, in __getitem__
        return self.value()[item]
      File "/usr/lib/python3.10/site-packages/salt/loader/lazy.py", line 336, in __getitem__
        super().__getitem__(item)  # try to get the item from the dictionary
      File "/usr/lib/python3.10/site-packages/salt/utils/lazy.py", line 105, in __getitem__
        raise KeyError(key)
    KeyError: 'transactional_update.apply'

Setup
I've installed a fresh microos server with salt-master and salt-minion version 3005.1-3.1

OS details:

NAME="openSUSE MicroOS"
# VERSION="20230124"
ID="opensuse-microos"
ID_LIKE="suse opensuse opensuse-tumbleweed"
VERSION_ID="20230124"
PRETTY_NAME="openSUSE MicroOS"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:microos:20230124"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
DOCUMENTATION_URL="https://en.opensuse.org/Portal:MicroOS"
LOGO="distributor-logo-MicroOS"

Please be as specific as possible and give set-up details.

  • VM (Virtualbox, KVM, etc. please specify)
    • VM running on ESXi 6.5

Steps to Reproduce the behavior
run salt '*' state.apply

Versions Report
image

@rdouman
Copy link
Author

rdouman commented May 11, 2023

Hi all,

I'm seeing more of this issue pop up on the internet, with no solution insight. Any idea when this will get priority ?

@rdouman
Copy link
Author

rdouman commented May 15, 2023

This bug seems to be related to saltstack/salt#59690

@meaksh
Copy link
Member

meaksh commented May 15, 2023

I did some tests around this and I was able to replicate the issue. Not yet sure if this is related with the upgrade to Salt 3005.1 / 3006.0, or with the Python 3.10 version.

Apparentely there is a kind of mess with LazyLoader imports, ending up with a wrong importing of the transactional_update execution module into the LazyLoader, exposing the functions under state.* instead of transactional_update.*.

I've not identified yet the root cause but I was able to workaround the issue using this patch in the minion side:

diff --git a/salt/modules/transactional_update.py b/salt/modules/transactional_update.py
index 6493966782..658ebccc6b 100644
--- a/salt/modules/transactional_update.py
+++ b/salt/modules/transactional_update.py
@@ -285,6 +285,8 @@ from salt.modules.state import _check_queue, _prior_running_states, _wait, runni
 
 __func_alias__ = {"apply_": "apply"}
 
+__virtualname__ = "transactional_update"
+
 log = logging.getLogger(__name__)
 
 
@@ -300,7 +302,7 @@ def __virtual__():
             _prior_running_states, globals()
         )
         running = salt.utils.functools.namespaced_function(running, globals())
-        return True
+        return __virtualname__
     else:
         return (False, "Module transactional_update requires a transactional system")

@rdouman
Copy link
Author

rdouman commented May 15, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants