@@ -164,12 +164,17 @@ def __walk_attribute(self, model_dict, attribute_name, attribute_location):
164164
165165 self ._logger .exiting (class_name = _class_name , method_name = _method_name )
166166
167- def fix_property_secrets (self , original_variables ):
167+ def fix_property_secrets (self ):
168168 # Just in case the credential cache has @@PROP in the model's attribute value,
169169 # we use the original variable file to resolve it,
170170 # so that the generated json/script files have the resolved property value(s) instead of the @@PROP token.
171171 # it's possible that the variable file is not specified, or does not exist yet.
172172
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+
173178 credential_caches = self .credential_injector .get_variable_cache ()
174179 for key in credential_caches :
175180 if variables .is_variable_string (credential_caches [key ]):
@@ -373,15 +378,20 @@ def prepare_models(self):
373378 # resolve variables in the model AFTER the clean and filter has been done,
374379 # but before generating output files.
375380
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 )
380390
381- variables .substitute (merged_model_dictionary , variable_map , self .model_context )
391+ variables .substitute (merged_model_dictionary , result_variable_map , self .model_context )
382392
383393 # correct any secret values that point to @@PROP values
384- self .fix_property_secrets (variable_map )
394+ self .fix_property_secrets ()
385395
386396 # apply final filter changes for the merged model to the last source model
387397 self ._apply_final_filters (merged_model_dictionary )
0 commit comments