You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
On a spawning platform, running a state module relying on dunders like __env__ via parallel: true fails with a NameError (this is probably an issue for __low__, __running__, __instance_id__, __lowstate__ and __user__ as well).
Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)
Please be as specific as possible and give set-up details.
---------- ID: foo Function: git.latest Name: https://github.com/saltstack/salt.git Result: False Comment: An exception occurred in this state: Traceback (most recent call last): File "/opt/salt/lib/python3.10/site-packages/salt/state.py", line 2161, in _call_parallel_target ret = instance.states[cdata["full"]](*cdata["args"], **cdata["kwargs"]) File "/opt/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 160, in __call__ ret = self.loader.run(run_func, *args, **kwargs) File "/opt/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1269, in run return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs) File "/opt/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1284, in _run_as return _func_or_method(*args, **kwargs) File "/opt/salt/lib/python3.10/site-packages/salt/states/git.py", line 726, in latest saltenv=__env__, NameError: name '__env__' is not defined Started: 10:46:38.229375 Duration: 7.989 ms Changes:
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
Salt: 3007.1Python Version:
Python: 3.10.14 (main, Apr 3 2024, 21:27:26) [Clang 15.0.0 (clang-1500.0.40.1)]Dependency Versions:
cffi: 1.16.0cherrypy: unknowndateutil: 2.8.2docker-py: Not Installedgitdb: Not Installedgitpython: Not InstalledJinja2: 3.1.4libgit2: Not Installedlooseversion: 1.3.0M2Crypto: Not InstalledMako: Not Installedmsgpack: 1.0.7msgpack-pure: Not Installedmysql-python: Not Installedpackaging: 23.1pycparser: 2.21pycrypto: Not Installedpycryptodome: 3.19.1pygit2: Not Installedpython-gnupg: 0.5.2PyYAML: 6.0.1PyZMQ: 25.1.2relenv: 0.16.0smmap: Not Installedtimelib: 0.3.0Tornado: 6.3.3ZMQ: 4.3.4Salt Package Information:
Package Type: onedirSystem Versions:
dist: darwin 23.6.0locale: utf-8machine: arm64release: 23.6.0system: Darwinversion: 14.7 arm64
Additional context inject_globals is defined in the parent process:
Description
On a spawning platform, running a state module relying on dunders like
__env__
viaparallel: true
fails with aNameError
(this is probably an issue for__low__
,__running__
,__instance_id__
,__lowstate__
and__user__
as well).Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)
Please be as specific as possible and give set-up details.
On bare-metal macOS with official 3007.1 package.
Note that Windows is a spawning platform as well.
Steps to Reproduce the behavior
Expected behavior
The clone works.
Screenshots
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Additional context
inject_globals
is defined in the parent process:salt/salt/state.py
Lines 2362 to 2372 in d7b4d10
__env__
is ensured to be defined in there as well:salt/salt/state.py
Lines 2414 to 2416 in d7b4d10
The parent process'
State
instance sets theinject_globals
attribute on its state loader:salt/salt/state.py
Line 2422 in d7b4d10
When
parallel
isTrue
,self.call_parallel
is calledsalt/salt/state.py
Lines 2435 to 2437 in d7b4d10
On spawning platforms, a new
State
instance has to be created, which also resets theinject_globals
attribute on the state module loader:salt/salt/state.py
Lines 2283 to 2291 in d7b4d10
And it's never redefined.
The text was updated successfully, but these errors were encountered: