def main(args): """ The main entry point for the discoverDomain tool. :param args: :return: """ _method_name = 'main' __logger.entering(class_name=_class_name, method_name=_method_name) for index, arg in enumerate(args): __logger.finer('sys.argv[{0}] = {1}', str(index), str(arg), class_name=_class_name, method_name=_method_name) helper = WlstHelper(ExceptionType.DISCOVER) helper.silence() exit_code = CommandLineArgUtil.PROG_OK_EXIT_CODE try: model_context = __process_args(args) except CLAException, ex: exit_code = ex.getExitCode() if exit_code != CommandLineArgUtil.HELP_EXIT_CODE: __logger.severe('WLSDPLY-20008', _program_name, ex.getLocalizedMessage(), error=ex, class_name=_class_name, method_name=_method_name) # create a minimal model for summary logging model_context = model_context_helper.create_exit_context(_program_name) __log_and_exit(model_context, exit_code, _class_name, _method_name)
except DeployException, de: __release_edit_session_and_disconnect() raise de exit_code = 0 try: # First we enable the stdout again and then redirect the stdoout to a string output stream # call isRestartRequired to get the output, capture the string and then silence wlst output again # __wlst_helper.enable_stdout() sostream = StringOutputStream() System.setOut(PrintStream(sostream)) restart_required = __wlst_helper.is_restart_required() is_restartreq_output = sostream.get_string() __wlst_helper.silence() if model_context.is_rollback_if_restart_required( ) and restart_required: __wlst_helper.cancel_edit() __logger.severe('WLSDPLY_09015', is_restartreq_output) exit_code = CommandLineArgUtil.PROG_ROLLBACK_IF_RESTART_EXIT_CODE else: __wlst_helper.save() __wlst_helper.activate() if restart_required: exit_code = CommandLineArgUtil.PROG_RESTART_REQUIRED except BundleAwareException, ex: __release_edit_session_and_disconnect() raise ex model_deployer.deploy_applications(model,