3636from wlsdeploy .exception .expection_types import ExceptionType
3737from wlsdeploy .logging .platform_logger import PlatformLogger
3838from wlsdeploy .tool .util import filter_helper
39+ from wlsdeploy .tool .util import model_context_helper
3940from wlsdeploy .tool .util import variable_injector_functions
4041from wlsdeploy .tool .util .alias_helper import AliasHelper
4142from wlsdeploy .tool .util .variable_injector import VariableInjector
4445from wlsdeploy .util import cla_helper
4546from wlsdeploy .util import model
4647from wlsdeploy .util import target_configuration_helper
48+ from wlsdeploy .util import tool_exit
4749from wlsdeploy .util .cla_utils import CommandLineArgUtil
4850from wlsdeploy .util .model import Model
4951from wlsdeploy .util .model_context import ModelContext
@@ -455,8 +457,10 @@ def _apply_filter_and_inject_variable(self, model, model_context, validator):
455457 variable_map = validator .load_variables (self .model_context .get_variable_file ())
456458 self .cache .update (variable_map )
457459
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
460464
461465def debug (format_string , * arguments ):
462466 """
@@ -480,6 +484,8 @@ def main():
480484 for index , arg in enumerate (sys .argv ):
481485 __logger .finer ('sys.argv[{0}] = {1}' , str (index ), str (arg ), class_name = _class_name , method_name = _method_name )
482486
487+ # create a minimal model for summary logging
488+ model_context = model_context_helper .create_exit_context (_program_name )
483489 _outputdir = None
484490
485491 try :
@@ -495,29 +501,29 @@ def main():
495501
496502 obj = PrepareModel (model1 , model_context , __logger , _outputdir )
497503 rc = obj .walk ()
498- System . exit ( rc )
504+ tool_exit . end ( model_context , rc )
499505
500506 except CLAException , ex :
501507 exit_code = 2
502508 if exit_code != CommandLineArgUtil .HELP_EXIT_CODE :
503509 __logger .severe ('WLSDPLY-20008' , _program_name , ex .getLocalizedMessage (), error = ex ,
504510 class_name = _class_name , method_name = _method_name )
505511 cla_helper .clean_up_temp_files ()
506- sys . exit ( exit_code )
512+ tool_exit . end ( model_context , exit_code )
507513 except CompareException , ce :
508514 cla_helper .clean_up_temp_files ()
509515 __logger .severe ('WLSDPLY-05704' , ce .getLocalizedMessage ())
510- System . exit ( 2 )
516+ tool_exit . end ( model_context , 2 )
511517 except PyWLSTException , pe :
512518 cla_helper .clean_up_temp_files ()
513519 __logger .severe ('WLSDPLY-05704' , pe .getLocalizedMessage ())
514- System . exit ( 2 )
520+ tool_exit . end ( model_context , 2 )
515521 except :
516522 exc_type , exc_obj , exc_tb = sys .exc_info ()
517523 eeString = traceback .format_exception (exc_type , exc_obj , exc_tb )
518524 cla_helper .clean_up_temp_files ()
519525 __logger .severe ('WLSDPLY-05704' , eeString )
520- System . exit ( 2 )
526+ tool_exit . end ( model_context , 2 )
521527
522528def format_message (key , * args ):
523529 """
0 commit comments