override
This module provides functionality to handle overriding variables in a spec file via the command-line interface. It includes functions to validate and replace variables in the spec file or environment block based on user-provided overrides.
error_override_vars(override_vars, spec_filepath)
Warns the user if any given variable name in the override list is not found in the original spec file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
override_vars
|
Dict[str, str]
|
A dictionary of variables to override, where keys are
variable names and values are their corresponding new values. Can
be |
required |
spec_filepath
|
str
|
The file path to the original spec file. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If any variable name in |
Source code in merlin/spec/override.py
replace_override_vars(env, override_vars)
Replaces variables in the given environment block with the provided override values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
env
|
Dict[str, str]
|
The environment block, represented as a dictionary where keys are environment variable names and values are their corresponding values. |
required |
override_vars
|
Dict[str, str]
|
A dictionary of variables to override, where keys are
variable names and values are their corresponding new values. Can be
|
required |
Returns:
| Type | Description |
|---|---|
Dict[str, str]
|
A new environment block with the override variables replaced. |