33The Universal Permissive License (UPL), Version 1.0
44"""
55import os
6+ import copy
67
78from oracle .weblogic .deploy .util import WLSDeployArchive
89from oracle .weblogic .deploy .util import VariableException
@@ -108,9 +109,15 @@ def validate_in_standalone_mode(self, model_dict, variables_file_name=None, arch
108109 """
109110 _method_name = 'validate_in_standalone_mode'
110111
112+ # We need to make a deep copy of model_dict here, to ensure it's
113+ # treated as a "read-only'" reference variable, during the variable
114+ # file validation process. The variable file validation process could
115+ # actually require changes to be made to the cloned model dictionary
116+ cloned_model_dict = copy .deepcopy (model_dict )
117+
111118 self ._logger .entering (variables_file_name , archive_file_name , class_name = _class_name , method_name = _method_name )
112119 self ._validation_mode = _ValidationModes .STANDALONE
113- self .__validate_model_file (model_dict , variables_file_name , archive_file_name )
120+ self .__validate_model_file (cloned_model_dict , variables_file_name , archive_file_name )
114121
115122 self ._logger .exiting (class_name = _class_name , method_name = _method_name )
116123 return self ._validation_results
@@ -137,10 +144,16 @@ def validate_in_tool_mode(self, model_dict, variables_file_name=None, archive_fi
137144 """
138145 _method_name = 'validate_in_tool_mode'
139146
147+ # We need to make a deep copy of model_dict here, to ensure it's
148+ # treated as a "read-only'" reference variable, during the variable
149+ # file validation process. The variable file validation process could
150+ # actually require changes to be made to the cloned model dictionary
151+ cloned_model_dict = copy .deepcopy (model_dict )
152+
140153 self ._logger .entering (variables_file_name , archive_file_name , class_name = _class_name , method_name = _method_name )
141154 return_code = Validator .ReturnCode .STOP
142155 self ._validation_mode = _ValidationModes .TOOL
143- self .__validate_model_file (model_dict , variables_file_name , archive_file_name )
156+ self .__validate_model_file (cloned_model_dict , variables_file_name , archive_file_name )
144157
145158 status = Validator .ValidationStatus .VALID
146159
@@ -212,8 +225,7 @@ def __validate_model_file(self, model_dict, variables_file_name, archive_file_na
212225 if variables_file_name is not None :
213226 self ._logger .info ('WLSDPLY-05004' , variables_file_name , class_name = _class_name , method_name = _method_name )
214227 try :
215- if self ._model_context .get_variable_file ():
216- self ._variable_properties = variables .load_variables (self ._model_context .get_variable_file ())
228+ self ._variable_properties = variables .load_variables (variables_file_name )
217229 variables .substitute (model_dict , self ._variable_properties )
218230 except VariableException , ve :
219231 ex = exception_helper .create_validate_exception ('WLSDPLY-20004' , 'validateModel' ,
0 commit comments