36
36
from wlsdeploy .exception .expection_types import ExceptionType
37
37
from wlsdeploy .logging .platform_logger import PlatformLogger
38
38
from wlsdeploy .tool .util import filter_helper
39
+ from wlsdeploy .tool .util import model_context_helper
39
40
from wlsdeploy .tool .util import variable_injector_functions
40
41
from wlsdeploy .tool .util .alias_helper import AliasHelper
41
42
from wlsdeploy .tool .util .variable_injector import VariableInjector
44
45
from wlsdeploy .util import cla_helper
45
46
from wlsdeploy .util import model
46
47
from wlsdeploy .util import target_configuration_helper
48
+ from wlsdeploy .util import tool_exit
47
49
from wlsdeploy .util .cla_utils import CommandLineArgUtil
48
50
from wlsdeploy .util .model import Model
49
51
from wlsdeploy .util .model_context import ModelContext
@@ -455,8 +457,10 @@ def _apply_filter_and_inject_variable(self, model, model_context, validator):
455
457
variable_map = validator .load_variables (self .model_context .get_variable_file ())
456
458
self .cache .update (variable_map )
457
459
458
- variable_injector .inject_variables_keyword_file ()
459
- return model
460
+ inserted , variable_model , variable_file_name = variable_injector .inject_variables_keyword_file ()
461
+ # return variable_model - if writing the variables file failed, this will be the original model.
462
+ # a warning is issued in inject_variables_keyword_file() if that was the case.
463
+ return variable_model
460
464
461
465
def debug (format_string , * arguments ):
462
466
"""
@@ -480,6 +484,8 @@ def main():
480
484
for index , arg in enumerate (sys .argv ):
481
485
__logger .finer ('sys.argv[{0}] = {1}' , str (index ), str (arg ), class_name = _class_name , method_name = _method_name )
482
486
487
+ # create a minimal model for summary logging
488
+ model_context = model_context_helper .create_exit_context (_program_name )
483
489
_outputdir = None
484
490
485
491
try :
@@ -495,29 +501,29 @@ def main():
495
501
496
502
obj = PrepareModel (model1 , model_context , __logger , _outputdir )
497
503
rc = obj .walk ()
498
- System . exit ( rc )
504
+ tool_exit . end ( model_context , rc )
499
505
500
506
except CLAException , ex :
501
507
exit_code = 2
502
508
if exit_code != CommandLineArgUtil .HELP_EXIT_CODE :
503
509
__logger .severe ('WLSDPLY-20008' , _program_name , ex .getLocalizedMessage (), error = ex ,
504
510
class_name = _class_name , method_name = _method_name )
505
511
cla_helper .clean_up_temp_files ()
506
- sys . exit ( exit_code )
512
+ tool_exit . end ( model_context , exit_code )
507
513
except CompareException , ce :
508
514
cla_helper .clean_up_temp_files ()
509
515
__logger .severe ('WLSDPLY-05704' , ce .getLocalizedMessage ())
510
- System . exit ( 2 )
516
+ tool_exit . end ( model_context , 2 )
511
517
except PyWLSTException , pe :
512
518
cla_helper .clean_up_temp_files ()
513
519
__logger .severe ('WLSDPLY-05704' , pe .getLocalizedMessage ())
514
- System . exit ( 2 )
520
+ tool_exit . end ( model_context , 2 )
515
521
except :
516
522
exc_type , exc_obj , exc_tb = sys .exc_info ()
517
523
eeString = traceback .format_exception (exc_type , exc_obj , exc_tb )
518
524
cla_helper .clean_up_temp_files ()
519
525
__logger .severe ('WLSDPLY-05704' , eeString )
520
- System . exit ( 2 )
526
+ tool_exit . end ( model_context , 2 )
521
527
522
528
def format_message (key , * args ):
523
529
"""
0 commit comments