From aa3c3c22533edf50473e9d0abed9080c1f7f05a1 Mon Sep 17 00:00:00 2001 From: Robert Patrick Date: Thu, 5 Jan 2023 13:04:10 -0600 Subject: [PATCH 1/2] removing deprecated -domain_resource_file argument --- core/src/main/python/extract_resource.py | 17 ++---------- .../util/targets/additional_output_helper.py | 26 +------------------ .../main/python/wlsdeploy/util/cla_utils.py | 5 ---- .../python/wlsdeploy/util/model_context.py | 13 ---------- .../wlsdeploy/tool/extract/extract_test.py | 4 +-- 5 files changed, 5 insertions(+), 60 deletions(-) diff --git a/core/src/main/python/extract_resource.py b/core/src/main/python/extract_resource.py index 2f19d0323d..e4f9a227ce 100644 --- a/core/src/main/python/extract_resource.py +++ b/core/src/main/python/extract_resource.py @@ -35,7 +35,8 @@ __required_arguments = [ CommandLineArgUtil.MODEL_FILE_SWITCH, - CommandLineArgUtil.ORACLE_HOME_SWITCH + CommandLineArgUtil.ORACLE_HOME_SWITCH, + CommandLineArgUtil.OUTPUT_DIR_SWITCH ] __optional_arguments = [ @@ -49,8 +50,6 @@ CommandLineArgUtil.PASSPHRASE_SWITCH, CommandLineArgUtil.PASSPHRASE_FILE_SWITCH, CommandLineArgUtil.PASSPHRASE_ENV_SWITCH, - CommandLineArgUtil.OUTPUT_DIR_SWITCH, # move to __required_arguments once DOMAIN_RESOURCE_FILE_SWITCH is removed - CommandLineArgUtil.DOMAIN_RESOURCE_FILE_SWITCH # deprecated, only this program uses it ] @@ -80,18 +79,6 @@ def __process_args(args): # allow unresolved tokens and archive entries argument_map[CommandLineArgUtil.VALIDATION_METHOD] = validate_configuration.LAX_METHOD - # warn about deprecated -domain_resource_file argument. - # not needed once -domain_resource_file is removed and -output_dir moves to __required_arguments. - if CommandLineArgUtil.DOMAIN_RESOURCE_FILE_SWITCH in argument_map: - __logger.warning('WLSDPLY-10040', CommandLineArgUtil.DOMAIN_RESOURCE_FILE_SWITCH, - CommandLineArgUtil.OUTPUT_DIR_SWITCH, class_name=_class_name, method_name=_method_name) - elif CommandLineArgUtil.OUTPUT_DIR_SWITCH not in argument_map: - ex = exception_helper.create_cla_exception(ExitCode.USAGE_ERROR, 'WLSDPLY-20005', - _program_name, CommandLineArgUtil.OUTPUT_DIR_SWITCH, - class_name=_class_name, method_name=_method_name) - __logger.throwing(ex, class_name=_class_name, method_name=_method_name) - raise ex - return model_context_helper.create_context(_program_name, argument_map) diff --git a/core/src/main/python/wlsdeploy/tool/util/targets/additional_output_helper.py b/core/src/main/python/wlsdeploy/tool/util/targets/additional_output_helper.py index c74b3862d4..413379ab3e 100644 --- a/core/src/main/python/wlsdeploy/tool/util/targets/additional_output_helper.py +++ b/core/src/main/python/wlsdeploy/tool/util/targets/additional_output_helper.py @@ -90,13 +90,7 @@ def create_additional_output(model, model_context, aliases, credential_injector, template_hash = _build_template_hash(model, model_context, aliases, credential_injector, domain_home_override) for index, template_name in enumerate(template_names): source_file_name = _get_template_source_name(template_name, target_configuration) - - # special processing for deprecated -domain_resource_file argument of extractDomainResource - extract_output_file = _get_extract_output_file(template_name, index, model_context) - if extract_output_file: - output_file = extract_output_file - else: - output_file = File(os.path.join(output_dir, template_name)) + output_file = File(os.path.join(output_dir, template_name)) _create_file(source_file_name, template_hash, output_file, exception_type) @@ -104,24 +98,6 @@ def create_additional_output(model, model_context, aliases, credential_injector, crd_file_updater.update_from_model(output_file, model, crd_helper) -# *** DELETE METHOD WHEN deprecated -domain_resource_file IS REMOVED *** -def _get_extract_output_file(template_name, index, model_context): - """ - Special processing for deprecated -domain_resource_file argument used by extractDomainResource. - Use the directory of -domain_resource_file for all templates, - and the name of -domain_resource_file for the first (usually only) template. - """ - _method_name = '_get_extract_output_file' - - resource_file = model_context.get_domain_resource_file() - if resource_file: - output_dir, output_name = os.path.split(resource_file) - if index > 0: - output_name = template_name - return File(os.path.join(output_dir, output_name)) - return None - - def _create_file(template_name, template_hash, output_file, exception_type): """ Read the template from the resource stream, perform any substitutions, diff --git a/core/src/main/python/wlsdeploy/util/cla_utils.py b/core/src/main/python/wlsdeploy/util/cla_utils.py index b583164968..4f80b75126 100644 --- a/core/src/main/python/wlsdeploy/util/cla_utils.py +++ b/core/src/main/python/wlsdeploy/util/cla_utils.py @@ -95,8 +95,6 @@ class CommandLineArgUtil(object): VARIABLE_INJECTOR_FILE_SWITCH = '-variable_injector_file' VARIABLE_KEYWORDS_FILE_SWITCH = '-variable_keywords_file' VARIABLE_PROPERTIES_FILE_SWITCH = '-variable_properties_file' - # extractDomainResource output file - DOMAIN_RESOURCE_FILE_SWITCH = '-domain_resource_file' OUTPUT_DIR_SWITCH = "-output_dir" WAIT_FOR_EDIT_LOCK_SWITCH = "-wait_for_edit_lock" TARGET_SWITCH = '-target' @@ -1022,9 +1020,6 @@ def _validate_variable_properties_file_arg(self, value): raise ex return variables.getAbsolutePath() - def is_domain_resource_file_key(self, key): - return self.DOMAIN_RESOURCE_FILE_SWITCH == key - def _validate_domain_resource_file_arg(self, value): method_name = '_validate_domain_resource_file_arg' diff --git a/core/src/main/python/wlsdeploy/util/model_context.py b/core/src/main/python/wlsdeploy/util/model_context.py index 0596db0dfd..5cf4fc0fbc 100644 --- a/core/src/main/python/wlsdeploy/util/model_context.py +++ b/core/src/main/python/wlsdeploy/util/model_context.py @@ -91,7 +91,6 @@ def __init__(self, program_name, arg_map): self._validation_method = None self._validate_configuration = None # lazy load self._cancel_changes_if_restart_required = None - self._domain_resource_file = None self._output_dir = None self._target = None self._target_configuration = None # lazy load @@ -236,9 +235,6 @@ def __copy_from_args(self, arg_map): if CommandLineArgUtil.TARGET_VERSION_SWITCH in arg_map: self._wl_version = arg_map[CommandLineArgUtil.TARGET_VERSION_SWITCH] - if CommandLineArgUtil.DOMAIN_RESOURCE_FILE_SWITCH in arg_map: - self._domain_resource_file = arg_map[CommandLineArgUtil.DOMAIN_RESOURCE_FILE_SWITCH] - if CommandLineArgUtil.TRAILING_ARGS_SWITCH in arg_map: self._trailing_args = arg_map[CommandLineArgUtil.TRAILING_ARGS_SWITCH] @@ -343,8 +339,6 @@ def __copy__(self): arg_map[CommandLineArgUtil.VALIDATION_METHOD] = self._validation_method if self._wl_version is not None: arg_map[CommandLineArgUtil.TARGET_VERSION_SWITCH] = self._wl_version - if self._domain_resource_file is not None: - arg_map[CommandLineArgUtil.DOMAIN_RESOURCE_FILE_SWITCH] = self._domain_resource_file if self._trailing_args is not None: arg_map[CommandLineArgUtil.TRAILING_ARGS_SWITCH] = self._trailing_args if self._target is not None: @@ -442,13 +436,6 @@ def get_domain_typedef(self): """ return self._domain_typedef - def get_domain_resource_file(self): - """ - Get the domain resource file. - :return: the domain resource file - """ - return self._domain_resource_file - def get_admin_url(self): """ Get the admin URL. diff --git a/core/src/test/python/wlsdeploy/tool/extract/extract_test.py b/core/src/test/python/wlsdeploy/tool/extract/extract_test.py index 21629cd50d..e27b7fc5ae 100644 --- a/core/src/test/python/wlsdeploy/tool/extract/extract_test.py +++ b/core/src/test/python/wlsdeploy/tool/extract/extract_test.py @@ -130,11 +130,10 @@ def _extract_domain_resource(self, suffix): model_dict = translator.parse() model = Model(model_dict) - resource_file = os.path.join(self.EXTRACT_OUTPUT_DIR, 'domain-resource-' + suffix + '.yaml') args_map = { '-domain_home': '/u01/domain', '-oracle_home': '/oracle', - '-domain_resource_file': resource_file, + '-output_dir': self.EXTRACT_OUTPUT_DIR, '-target': 'wko' } model_context = ModelContext('ExtractTest', args_map) @@ -143,5 +142,6 @@ def _extract_domain_resource(self, suffix): extractor = DomainResourceExtractor(model, model_context, aliases, self.__logger) extractor.extract() + resource_file = os.path.join(self.EXTRACT_OUTPUT_DIR, 'wko-domain.yaml') translator = FileToPython(resource_file, use_ordering=True) return translator.parse() From 71e3b291dfb9d1fa7860943bb4db649c6e94baf5 Mon Sep 17 00:00:00 2001 From: Robert Patrick Date: Thu, 5 Jan 2023 14:15:14 -0600 Subject: [PATCH 2/2] removing more references to -domain_resource_file arg --- core/src/main/python/wlsdeploy/util/cla_utils.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/core/src/main/python/wlsdeploy/util/cla_utils.py b/core/src/main/python/wlsdeploy/util/cla_utils.py index 4f80b75126..ca11b9c607 100644 --- a/core/src/main/python/wlsdeploy/util/cla_utils.py +++ b/core/src/main/python/wlsdeploy/util/cla_utils.py @@ -322,10 +322,6 @@ def process_args(self, args, tool_type=TOOL_TYPE_DEFAULT, trailing_arg_count=0): value, idx = self._get_arg_value(args, idx) full_path = self._validate_variable_properties_file_arg(value) self._add_arg(key, full_path, True) - elif self.is_domain_resource_file_key(key): - value, idx = self._get_arg_value(args, idx) - full_path = self._validate_domain_resource_file_arg(value) - self._add_arg(key, full_path, True) elif self.is_boolean_switch(key): self._add_arg(key, True) elif self.is_compare_model_output_dir_switch(key): @@ -1020,18 +1016,6 @@ def _validate_variable_properties_file_arg(self, value): raise ex return variables.getAbsolutePath() - def _validate_domain_resource_file_arg(self, value): - method_name = '_validate_domain_resource_file_arg' - - try: - variables = JFileUtils.validateFileName(value) - except JIllegalArgumentException, iae: - ex = create_cla_exception(ExitCode.ARG_VALIDATION_ERROR, - 'WLSDPLY-01637', value, iae.getLocalizedMessage(), error=iae) - _logger.throwing(ex, class_name=self._class_name, method_name=method_name) - raise ex - return variables.getAbsolutePath() - def is_boolean_switch(self, key): return key in self.BOOLEAN_SWITCHES