Skip to content

Commit f951158

Browse files
lkubbdwoz
authored andcommitted
Account for NamedLoaderContext __opts__ in OptsDict
1 parent ed67e54 commit f951158

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

salt/utils/optsdict.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
import weakref
3838
from typing import Any
3939

40+
NamedLoaderContext = None
41+
4042
log = logging.getLogger(__name__)
4143

4244

@@ -1219,6 +1221,13 @@ def safe_opts_copy(opts: Any, name: str | None = None) -> OptsDict:
12191221
from salt.utils.optsdict import safe_opts_copy
12201222
opts = safe_opts_copy(opts, name="loader:states")
12211223
"""
1224+
global NamedLoaderContext
1225+
if NamedLoaderContext is None:
1226+
from salt.loader.context import NamedLoaderContext
1227+
1228+
if isinstance(opts, NamedLoaderContext):
1229+
opts = opts.value()
1230+
12221231
if isinstance(opts, OptsDict):
12231232
# Create child from current opts, not root
12241233
# This ensures the child can see all values in the current opts,

0 commit comments

Comments
 (0)