3
3
The Universal Permissive License (UPL), Version 1.0
4
4
"""
5
5
import os
6
+ import copy
6
7
7
8
from oracle .weblogic .deploy .util import WLSDeployArchive
8
9
from oracle .weblogic .deploy .util import VariableException
@@ -108,9 +109,15 @@ def validate_in_standalone_mode(self, model_dict, variables_file_name=None, arch
108
109
"""
109
110
_method_name = 'validate_in_standalone_mode'
110
111
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
+
111
118
self ._logger .entering (variables_file_name , archive_file_name , class_name = _class_name , method_name = _method_name )
112
119
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 )
114
121
115
122
self ._logger .exiting (class_name = _class_name , method_name = _method_name )
116
123
return self ._validation_results
@@ -137,10 +144,16 @@ def validate_in_tool_mode(self, model_dict, variables_file_name=None, archive_fi
137
144
"""
138
145
_method_name = 'validate_in_tool_mode'
139
146
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
+
140
153
self ._logger .entering (variables_file_name , archive_file_name , class_name = _class_name , method_name = _method_name )
141
154
return_code = Validator .ReturnCode .STOP
142
155
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 )
144
157
145
158
status = Validator .ValidationStatus .VALID
146
159
@@ -212,8 +225,7 @@ def __validate_model_file(self, model_dict, variables_file_name, archive_file_na
212
225
if variables_file_name is not None :
213
226
self ._logger .info ('WLSDPLY-05004' , variables_file_name , class_name = _class_name , method_name = _method_name )
214
227
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 )
217
229
variables .substitute (model_dict , self ._variable_properties )
218
230
except VariableException , ve :
219
231
ex = exception_helper .create_validate_exception ('WLSDPLY-20004' , 'validateModel' ,
0 commit comments