def _archive_contains_model_file(archive_file_name, logger): _method_name = '__archive_contains_model_file' try: archive = WLSDeployArchive(archive_file_name) logger.finer('archive_file={0}', archive.getArchiveFileName(), class_name=_class_name, method_name=_method_name) response = archive.containsModel() except (IllegalArgumentException, WLSDeployArchiveIOException), e: ex = exception_helper.create_integration_test_exception('WLSDPLY-19300', archive_file_name, e.getLocalizedMessage(), error=e) raise ex
model_file_name = optional_arg_map[CommandLineArgUtil.MODEL_FILE_SWITCH] try: FileUtils.validateExistingFile(model_file_name) except IllegalArgumentException, iae: ex = exception_helper.create_cla_exception('WLSDPLY-20006', _program_name, model_file_name, iae.getLocalizedMessage(), error=iae) ex.setExitCode(CommandLineArgUtil.ARG_VALIDATION_ERROR_EXIT_CODE) __logger.throwing(ex, class_name=_class_name, method_name=_method_name) raise ex elif CommandLineArgUtil.ARCHIVE_FILE_SWITCH in optional_arg_map: archive_file_name = optional_arg_map[CommandLineArgUtil.ARCHIVE_FILE_SWITCH] try: archive_file = WLSDeployArchive(archive_file_name) contains_model = archive_file.containsModel() if not contains_model: ex = exception_helper.create_cla_exception('WLSDPLY-19603', archive_file_name) ex.setExitCode(CommandLineArgUtil.ARG_VALIDATION_ERROR_EXIT_CODE) __logger.throwing(ex, class_name=_class_name, method_name=_method_name) raise ex else: __tmp_model_dir = FileUtils.createTempDirectory(_program_name) tmp_model_file = \ FileUtils.fixupFileSeparatorsForJython(archive_file.extractModel(__tmp_model_dir).getAbsolutePath()) except (IllegalArgumentException, IllegalStateException, WLSDeployArchiveIOException), archex: ex = exception_helper.create_cla_exception('WLSDPLY-20010', _program_name, archive_file_name, archex.getLocalizedMessage(), error=archex) ex.setExitCode(CommandLineArgUtil.ARG_VALIDATION_ERROR_EXIT_CODE) __logger.throwing(ex, class_name=_class_name, method_name=_method_name) raise ex
error=iae) ex.setExitCode(CommandLineArgUtil.ARG_VALIDATION_ERROR_EXIT_CODE) __logger.throwing(ex, class_name=_class_name, method_name=_method_name) raise ex elif CommandLineArgUtil.ARCHIVE_FILE_SWITCH in optional_arg_map: archive_file_name = optional_arg_map[ CommandLineArgUtil.ARCHIVE_FILE_SWITCH] try: archive_file = WLSDeployArchive(archive_file_name) # # If the model file was not specified, check to see if the archive contains one. # If so, extract it and use it; otherwise, validate will only validate the archive structure. # if archive_file.containsModel(): __tmp_model_dir = FileUtils.createTempDirectory(_program_name) model_file = archive_file.extractModel(__tmp_model_dir) optional_arg_map[ CommandLineArgUtil.MODEL_FILE_SWITCH] = model_file except (IllegalArgumentException, IllegalStateException, WLSDeployArchiveIOException), archex: ex = exception_helper.create_cla_exception( 'WLSDPLY-20010', _program_name, archive_file_name, archex.getLocalizedMessage(), error=archex) ex.setExitCode(CommandLineArgUtil.ARG_VALIDATION_ERROR_EXIT_CODE) __logger.throwing(ex, class_name=_class_name,