@@ -164,12 +164,17 @@ def __walk_attribute(self, model_dict, attribute_name, attribute_location):
164
164
165
165
self ._logger .exiting (class_name = _class_name , method_name = _method_name )
166
166
167
- def fix_property_secrets (self , original_variables ):
167
+ def fix_property_secrets (self ):
168
168
# Just in case the credential cache has @@PROP in the model's attribute value,
169
169
# we use the original variable file to resolve it,
170
170
# so that the generated json/script files have the resolved property value(s) instead of the @@PROP token.
171
171
# it's possible that the variable file is not specified, or does not exist yet.
172
172
173
+ original_variables = {}
174
+ variable_file = self .model_context .get_variable_file ()
175
+ if variable_file is not None and os .path .exists (variable_file ):
176
+ original_variables = variables .load_variables (variable_file )
177
+
173
178
credential_caches = self .credential_injector .get_variable_cache ()
174
179
for key in credential_caches :
175
180
if variables .is_variable_string (credential_caches [key ]):
@@ -373,15 +378,20 @@ def prepare_models(self):
373
378
# resolve variables in the model AFTER the clean and filter has been done,
374
379
# but before generating output files.
375
380
376
- variable_map = {}
377
- variable_file = self .model_context .get_variable_file ()
378
- if variable_file is not None and os .path .exists (variable_file ):
379
- variable_map = variables .load_variables (variable_file )
381
+ result_variable_map = {}
382
+ source_variable_file = self .model_context .get_variable_file ()
383
+ if source_variable_file :
384
+ result_variable_file = os .path .join (self .output_dir , os .path .basename (source_variable_file ))
385
+ else :
386
+ result_variable_file = variables .get_default_variable_file_name (self .model_context )
387
+
388
+ if os .path .exists (result_variable_file ):
389
+ result_variable_map = variables .load_variables (result_variable_file )
380
390
381
- variables .substitute (merged_model_dictionary , variable_map , self .model_context )
391
+ variables .substitute (merged_model_dictionary , result_variable_map , self .model_context )
382
392
383
393
# correct any secret values that point to @@PROP values
384
- self .fix_property_secrets (variable_map )
394
+ self .fix_property_secrets ()
385
395
386
396
# apply final filter changes for the merged model to the last source model
387
397
self ._apply_final_filters (merged_model_dictionary )
0 commit comments