@@ -184,12 +184,8 @@ def _resources_for_config(config: dict, vars: dict):
184
184
185
185
186
186
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
-
191
187
yaml_config_ = yaml_config .copy ()
192
- cli_config_ = cli_config .copy ()
188
+ cli_config_ = cli_config .copy () if cli_config else {}
193
189
blueprint_args : dict [str , Any ] = {}
194
190
195
191
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
203
199
run_mode = yaml_config_ .pop ("run_mode" , None ) or cli_config_ .pop ("run_mode" , None )
204
200
scope = yaml_config_ .pop ("scope" , None ) or cli_config_ .pop ("scope" , None )
205
201
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 {}
207
203
vars_spec = yaml_config_ .pop ("vars" , [])
208
204
209
205
if allowlist :
@@ -227,16 +223,15 @@ def collect_blueprint_config(yaml_config: dict, cli_config: Optional[dict[str, A
227
223
if schema :
228
224
blueprint_args ["schema" ] = schema
229
225
230
- if vars :
231
- blueprint_args ["vars" ] = vars
226
+ blueprint_args ["vars" ] = input_vars
232
227
233
228
if vars_spec :
234
229
if not isinstance (vars_spec , list ):
235
230
raise ValueError ("vars config entry must be a list of dicts" )
236
231
blueprint_args ["vars_spec" ] = vars_spec
232
+ blueprint_args ["vars" ] = set_vars_defaults (vars_spec , blueprint_args ["vars" ])
237
233
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" ])
240
235
241
236
if len (resources ) == 0 :
242
237
raise ValueError ("No resources found in config" )
0 commit comments