43
43
from wlsdeploy .util import tool_exit
44
44
from wlsdeploy .util .cla_utils import CommandLineArgUtil
45
45
from wlsdeploy .util .cla_utils import TOOL_TYPE_CREATE
46
+ from wlsdeploy .util .exit_code import ExitCode
46
47
from wlsdeploy .util .weblogic_helper import WebLogicHelper
47
48
from wlsdeploy .tool .create import atp_helper
48
49
from wlsdeploy .tool .create import ssl_helper
@@ -128,7 +129,7 @@ def __process_java_home_arg(optional_arg_map):
128
129
try :
129
130
java_home = FileUtils .validateExistingDirectory (java_home_name )
130
131
except IllegalArgumentException , iae :
131
- ex = exception_helper .create_cla_exception (CommandLineArgUtil . ARG_VALIDATION_ERROR_EXIT_CODE ,
132
+ ex = exception_helper .create_cla_exception (ExitCode . ARG_VALIDATION_ERROR ,
132
133
'WLSDPLY-12400' , _program_name , java_home_name ,
133
134
iae .getLocalizedMessage (), error = iae )
134
135
__logger .throwing (ex , class_name = _class_name , method_name = _method_name )
@@ -149,7 +150,7 @@ def __process_domain_location_args(optional_arg_map):
149
150
has_parent = CommandLineArgUtil .DOMAIN_PARENT_SWITCH in optional_arg_map
150
151
151
152
if (has_home and has_parent ) or (not has_home and not has_parent ):
152
- ex = exception_helper .create_cla_exception (CommandLineArgUtil . USAGE_ERROR_EXIT_CODE ,
153
+ ex = exception_helper .create_cla_exception (ExitCode . USAGE_ERROR ,
153
154
'WLSDPLY-20025' , _program_name ,
154
155
CommandLineArgUtil .DOMAIN_PARENT_SWITCH ,
155
156
CommandLineArgUtil .DOMAIN_HOME_SWITCH )
@@ -183,7 +184,7 @@ def __process_rcu_args(optional_arg_map, domain_type, domain_typedef):
183
184
try :
184
185
password = getcreds .getpass ('WLSDPLY-12403' )
185
186
except IOException , ioe :
186
- ex = exception_helper .create_cla_exception (CommandLineArgUtil . ARG_VALIDATION_ERROR_EXIT_CODE ,
187
+ ex = exception_helper .create_cla_exception (ExitCode . ARG_VALIDATION_ERROR ,
187
188
'WLSDPLY-12404' , ioe .getLocalizedMessage (),
188
189
error = ioe )
189
190
__logger .throwing (ex , class_name = _class_name , method_name = _method_name )
@@ -193,14 +194,14 @@ def __process_rcu_args(optional_arg_map, domain_type, domain_typedef):
193
194
try :
194
195
password = getcreds .getpass ('WLSDPLY-12405' )
195
196
except IOException , ioe :
196
- ex = exception_helper .create_cla_exception (CommandLineArgUtil . ARG_VALIDATION_ERROR_EXIT_CODE ,
197
+ ex = exception_helper .create_cla_exception (ExitCode . ARG_VALIDATION_ERROR ,
197
198
'WLSDPLY-12406' , ioe .getLocalizedMessage (),
198
199
error = ioe )
199
200
__logger .throwing (ex , class_name = _class_name , method_name = _method_name )
200
201
raise ex
201
202
optional_arg_map [CommandLineArgUtil .RCU_SCHEMA_PASS_SWITCH ] = String (password )
202
203
else :
203
- ex = exception_helper .create_cla_exception (CommandLineArgUtil . USAGE_ERROR_EXIT_CODE ,
204
+ ex = exception_helper .create_cla_exception (ExitCode . USAGE_ERROR ,
204
205
'WLSDPLY-12407' , _program_name ,
205
206
CommandLineArgUtil .RCU_DB_SWITCH ,
206
207
CommandLineArgUtil .RCU_PREFIX_SWITCH )
@@ -223,7 +224,7 @@ def __process_opss_args(optional_arg_map):
223
224
try :
224
225
passphrase = getcreds .getpass ('WLSDPLY-20027' )
225
226
except IOException , ioe :
226
- ex = exception_helper .create_cla_exception (CommandLineArgUtil . ARG_VALIDATION_ERROR_EXIT_CODE ,
227
+ ex = exception_helper .create_cla_exception (ExitCode . ARG_VALIDATION_ERROR ,
227
228
'WLSDPLY-20028' , ioe .getLocalizedMessage (), error = ioe )
228
229
__logger .throwing (ex , class_name = _class_name , method_name = _method_name )
229
230
raise ex
@@ -259,15 +260,15 @@ def validate_rcu_args_and_model(model_context, model, archive_helper, aliases):
259
260
else :
260
261
__logger .severe ('WLSDPLY-12411' , error = None , class_name = _class_name , method_name = _method_name )
261
262
cla_helper .clean_up_temp_files ()
262
- tool_exit .end (model_context , CommandLineArgUtil . PROG_ERROR_EXIT_CODE )
263
+ tool_exit .end (model_context , ExitCode . ERROR )
263
264
264
265
else :
265
266
if model_context .get_domain_typedef ().required_rcu ():
266
267
if not model_context .get_rcu_database () or not model_context .get_rcu_prefix ():
267
268
__logger .severe ('WLSDPLY-12408' , model_context .get_domain_type (), CommandLineArgUtil .RCU_DB_SWITCH ,
268
269
CommandLineArgUtil .RCU_PREFIX_SWITCH )
269
270
cla_helper .clean_up_temp_files ()
270
- tool_exit .end (model_context , CommandLineArgUtil . PROG_ERROR_EXIT_CODE )
271
+ tool_exit .end (model_context , ExitCode . ERROR )
271
272
272
273
return has_atpdbinfo , has_ssldbinfo
273
274
@@ -303,13 +304,13 @@ def main(args):
303
304
304
305
WlstHelper (ExceptionType .CREATE ).silence ()
305
306
306
- exit_code = CommandLineArgUtil . PROG_OK_EXIT_CODE
307
+ exit_code = ExitCode . OK
307
308
308
309
try :
309
310
model_context = __process_args (args )
310
311
except CLAException , ex :
311
312
exit_code = ex .getExitCode ()
312
- if exit_code != CommandLineArgUtil . HELP_EXIT_CODE :
313
+ if exit_code != ExitCode . HELP :
313
314
__logger .severe ('WLSDPLY-20008' , _program_name , ex .getLocalizedMessage (), error = ex ,
314
315
class_name = _class_name , method_name = _method_name )
315
316
cla_helper .clean_up_temp_files ()
@@ -351,25 +352,25 @@ def main(args):
351
352
__logger .severe ('WLSDPLY-12409' , _program_name , ex .getLocalizedMessage (), error = ex ,
352
353
class_name = _class_name , method_name = _method_name )
353
354
cla_helper .clean_up_temp_files ()
354
- tool_exit .end (model_context , CommandLineArgUtil . PROG_ERROR_EXIT_CODE )
355
+ tool_exit .end (model_context , ExitCode . ERROR )
355
356
356
357
except CreateException , ex :
357
358
__logger .severe ('WLSDPLY-12409' , _program_name , ex .getLocalizedMessage (), error = ex ,
358
359
class_name = _class_name , method_name = _method_name )
359
360
cla_helper .clean_up_temp_files ()
360
- tool_exit .end (model_context , CommandLineArgUtil . PROG_ERROR_EXIT_CODE )
361
+ tool_exit .end (model_context , ExitCode . ERROR )
361
362
362
363
except IOException , ex :
363
364
__logger .severe ('WLSDPLY-12409' , _program_name , ex .getLocalizedMessage (), error = ex ,
364
365
class_name = _class_name , method_name = _method_name )
365
366
cla_helper .clean_up_temp_files ()
366
- tool_exit .end (model_context , CommandLineArgUtil . PROG_ERROR_EXIT_CODE )
367
+ tool_exit .end (model_context , ExitCode . ERROR )
367
368
368
369
except DeployException , ex :
369
370
__logger .severe ('WLSDPLY-12410' , _program_name , ex .getLocalizedMessage (), error = ex ,
370
371
class_name = _class_name , method_name = _method_name )
371
372
cla_helper .clean_up_temp_files ()
372
- tool_exit .end (model_context , CommandLineArgUtil . PROG_ERROR_EXIT_CODE )
373
+ tool_exit .end (model_context , ExitCode . ERROR )
373
374
374
375
cla_helper .clean_up_temp_files ()
375
376
0 commit comments