Skip to content

Commit 71686bf

Browse files
fix(parsing): reserve key before vars are loaded.\nfix(parsing): only allow param interpolation in cmd.
1 parent 54e1cb1 commit 71686bf

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

dvc/parsing/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,16 @@ def __init__(self, repo: "Repo", wdir: str, d: dict):
174174
check_interpolations(vars_, VARS_KWD, self.relpath)
175175
self.context: Context = Context()
176176

177+
# Reserve namespace to prevent conflicts with
178+
# ${PARAMS_NAMESPACE.*} interpolation - must be done before loading vars
179+
self.context._reserved_keys[PARAMS_NAMESPACE] = True
180+
177181
try:
178182
args = fs, vars_, wdir # load from `vars` section
179183
self.context.load_from_vars(*args, default=DEFAULT_PARAMS_FILE)
180184
except ContextError as exc:
181185
format_and_raise(exc, "'vars'", self.relpath)
182186

183-
# Reserve namespace to prevent conflicts with
184-
# ${{PARAMS_NAMESPACE}.*} interpolation
185-
self.context._reserved_keys[PARAMS_NAMESPACE] = True
186-
187187
# Load global-level params for ${PARAMS_NAMESPACE.*} interpolation
188188
global_params = d.get(PARAMS_KWD, [])
189189
if global_params:
@@ -450,7 +450,7 @@ def _resolve(
450450
) -> "DictStrAny":
451451
# Check if params interpolation is used in restricted fields
452452
if has_params_interpolation(value):
453-
allowed_fields = {"cmd", "outs"}
453+
allowed_fields = {"cmd"}
454454
if key not in allowed_fields:
455455
raise ResolveError(
456456
f"failed to parse '{self.where}.{self.name}.{key}' "

0 commit comments

Comments
 (0)