32
32
from wlsdeploy .logging .platform_logger import PlatformLogger
33
33
from wlsdeploy .tool .create .domain_creator import DomainCreator
34
34
from wlsdeploy .tool .create .domain_typedef import DomainTypedef
35
+ from wlsdeploy .tool .util import filter_helper
35
36
from wlsdeploy .tool .validate .validator import Validator
36
37
from wlsdeploy .util import getcreds
37
38
from wlsdeploy .util import variables
66
67
CommandLineArgUtil .PASSPHRASE_SWITCH
67
68
]
68
69
70
+
69
71
def __process_args (args ):
70
72
"""
71
73
Process the command-line arguments and prompt the user for any missing information
@@ -95,6 +97,7 @@ def __process_args(args):
95
97
domain_typedef .set_model_context (model_context )
96
98
return model_context
97
99
100
+
98
101
def __verify_required_args_present (required_arg_map ):
99
102
"""
100
103
Verify that the required args are present.
@@ -111,6 +114,7 @@ def __verify_required_args_present(required_arg_map):
111
114
raise ex
112
115
return
113
116
117
+
114
118
def __process_java_home_arg (optional_arg_map ):
115
119
"""
116
120
Verify that java_home is set. If not, set it.
@@ -132,6 +136,7 @@ def __process_java_home_arg(optional_arg_map):
132
136
optional_arg_map [CommandLineArgUtil .JAVA_HOME_SWITCH ] = java_home .getAbsolutePath ()
133
137
return
134
138
139
+
135
140
def __process_model_args (optional_arg_map ):
136
141
"""
137
142
Verify that either the model_file or archive_file was provided and exists.
@@ -176,6 +181,7 @@ def __process_model_args(optional_arg_map):
176
181
raise ex
177
182
return
178
183
184
+
179
185
def __process_rcu_args (optional_arg_map , domain_type , domain_typedef ):
180
186
"""
181
187
Determine if the RCU is needed and validate/prompt for any missing information
@@ -234,6 +240,7 @@ def __process_rcu_args(optional_arg_map, domain_type, domain_typedef):
234
240
raise ex
235
241
return
236
242
243
+
237
244
def __process_encryption_args (optional_arg_map ):
238
245
"""
239
246
Determine if the user is using our encryption and if so, get the passphrase.
@@ -255,6 +262,7 @@ def __process_encryption_args(optional_arg_map):
255
262
optional_arg_map [CommandLineArgUtil .PASSPHRASE_SWITCH ] = String (passphrase )
256
263
return
257
264
265
+
258
266
def __clean_up_temp_files ():
259
267
"""
260
268
If a temporary directory was created to extract the model from the archive, delete the directory and its contents.
@@ -265,6 +273,30 @@ def __clean_up_temp_files():
265
273
FileUtils .deleteDirectory (__tmp_model_dir )
266
274
__tmp_model_dir = None
267
275
276
+
277
+ def validate_model (model_dictionary , model_context , aliases ):
278
+ _method_name = 'validate_model'
279
+
280
+ try :
281
+ validator = Validator (model_context , aliases , wlst_mode = __wlst_mode )
282
+
283
+ # Since the have already performed all variable substitution,
284
+ # no need to pass the variable file for processing.
285
+ #
286
+ return_code = validator .validate_in_tool_mode (model_dictionary , variables_file_name = None ,
287
+ archive_file_name = model_context .get_archive_file_name ())
288
+ except ValidateException , ex :
289
+ __logger .severe ('WLSDPLY-20000' , _program_name , ex .getLocalizedMessage (), error = ex ,
290
+ class_name = _class_name , method_name = _method_name )
291
+ __clean_up_temp_files ()
292
+ sys .exit (CommandLineArgUtil .PROG_ERROR_EXIT_CODE )
293
+
294
+ if return_code == Validator .ReturnCode .STOP :
295
+ __logger .severe ('WLSDPLY-20001' , _program_name , class_name = _class_name , method_name = _method_name )
296
+ __clean_up_temp_files ()
297
+ sys .exit (CommandLineArgUtil .PROG_ERROR_EXIT_CODE )
298
+
299
+
268
300
def main ():
269
301
"""
270
302
The entry point for the create domain tool.
@@ -306,26 +338,12 @@ def main():
306
338
__clean_up_temp_files ()
307
339
sys .exit (CommandLineArgUtil .PROG_ERROR_EXIT_CODE )
308
340
309
- try :
310
- aliases = Aliases (model_context , wlst_mode = __wlst_mode )
311
- validator = Validator (model_context , aliases , wlst_mode = __wlst_mode )
312
-
313
- # Since the have already performed all variable substitution,
314
- # no need to pass the variable file for processing.
315
- #
316
- return_code = validator .validate_in_tool_mode (model ,
317
- variables_file_name = None ,
318
- archive_file_name = model_context .get_archive_file_name ())
319
- except ValidateException , ex :
320
- __logger .severe ('WLSDPLY-20000' , _program_name , ex .getLocalizedMessage (), error = ex ,
321
- class_name = _class_name , method_name = _method_name )
322
- __clean_up_temp_files ()
323
- sys .exit (CommandLineArgUtil .PROG_ERROR_EXIT_CODE )
341
+ aliases = Aliases (model_context , wlst_mode = __wlst_mode )
342
+ validate_model (model , model_context , aliases )
324
343
325
- if return_code == Validator .ReturnCode .STOP :
326
- __logger .severe ('WLSDPLY-20001' , _program_name , class_name = _class_name , method_name = _method_name )
327
- __clean_up_temp_files ()
328
- sys .exit (CommandLineArgUtil .PROG_ERROR_EXIT_CODE )
344
+ if filter_helper .apply_filters (model , "create" ):
345
+ # if any filters were applied, re-validate the model
346
+ validate_model (model , model_context , aliases )
329
347
330
348
try :
331
349
creator = DomainCreator (model , model_context , aliases )
0 commit comments