Skip to content

Commit f011b65

Browse files
committed
vars input as None bug
1 parent a618347 commit f011b65

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

titan/gitops.py

+5-10
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,8 @@ def _resources_for_config(config: dict, vars: dict):
184184

185185

186186
def collect_blueprint_config(yaml_config: dict, cli_config: Optional[dict[str, Any]] = None) -> BlueprintConfig:
187-
188-
if cli_config is None:
189-
cli_config = {}
190-
191187
yaml_config_ = yaml_config.copy()
192-
cli_config_ = cli_config.copy()
188+
cli_config_ = cli_config.copy() if cli_config else {}
193189
blueprint_args: dict[str, Any] = {}
194190

195191
for key in ["allowlist", "dry_run", "name", "run_mode"]:
@@ -203,7 +199,7 @@ def collect_blueprint_config(yaml_config: dict, cli_config: Optional[dict[str, A
203199
run_mode = yaml_config_.pop("run_mode", None) or cli_config_.pop("run_mode", None)
204200
scope = yaml_config_.pop("scope", None) or cli_config_.pop("scope", None)
205201
schema = yaml_config_.pop("schema", None) or cli_config_.pop("schema", None)
206-
vars = cli_config_.pop("vars", {})
202+
input_vars = cli_config_.pop("vars", {}) or {}
207203
vars_spec = yaml_config_.pop("vars", [])
208204

209205
if allowlist:
@@ -227,16 +223,15 @@ def collect_blueprint_config(yaml_config: dict, cli_config: Optional[dict[str, A
227223
if schema:
228224
blueprint_args["schema"] = schema
229225

230-
if vars:
231-
blueprint_args["vars"] = vars
226+
blueprint_args["vars"] = input_vars
232227

233228
if vars_spec:
234229
if not isinstance(vars_spec, list):
235230
raise ValueError("vars config entry must be a list of dicts")
236231
blueprint_args["vars_spec"] = vars_spec
232+
blueprint_args["vars"] = set_vars_defaults(vars_spec, blueprint_args["vars"])
237233

238-
vars = set_vars_defaults(vars_spec, vars)
239-
resources = _resources_for_config(yaml_config_, vars)
234+
resources = _resources_for_config(yaml_config_, blueprint_args["vars"])
240235

241236
if len(resources) == 0:
242237
raise ValueError("No resources found in config")

0 commit comments

Comments
 (0)