Skip to content

Commit c5282e7

Browse files
committed
Merge branch 'jira-wdt-883-default-wko-target' into 'main'
Change wko and wko* targets to point to current versioned config wko4* See merge request weblogic-cloud/weblogic-deploy-tooling!1693
2 parents 78ee75a + e238b7a commit c5282e7

File tree

9 files changed

+37
-9
lines changed

9 files changed

+37
-9
lines changed

core/src/main/python/wlsdeploy/util/cla_utils.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
from wlsdeploy.logging.platform_logger import PlatformLogger
2727
from wlsdeploy.tool.util.targets.model_crd_helper import VERRAZZANO_PRODUCT_KEY
2828
from wlsdeploy.util import path_helper
29-
import wlsdeploy.util.unicode_helper as str_helper
29+
from wlsdeploy.util import target_configuration as target_config_module
30+
from wlsdeploy.util import unicode_helper as str_helper
3031
from wlsdeploy.util.exit_code import ExitCode
3132
from wlsdeploy.util.target_configuration import TargetConfiguration
3233
from wlsdeploy.util.validate_configuration import VALIDATION_METHODS
@@ -1014,10 +1015,14 @@ def is_target_switch(self, key):
10141015
def _validate_target_arg(self, value):
10151016
method_name = '_validate_target_arg'
10161017

1018+
# log if the target key was translated to a version-specific key
1019+
target_config_key = target_config_module.get_target_configuration_key(value)
1020+
if target_config_key != value:
1021+
_logger.info("WLSDPLY-00917", target_config_key, value)
1022+
10171023
# Check if the target configuration file exists
10181024
_path_helper = path_helper.get_path_helper()
1019-
target_configuration_file = \
1020-
_path_helper.find_local_config_path(_path_helper.local_join('targets', value, 'target.json'))
1025+
target_configuration_file = target_config_module.get_target_configuration_path(value)
10211026
if not os.path.exists(target_configuration_file):
10221027
ex = create_cla_exception(ExitCode.ARG_VALIDATION_ERROR, 'WLSDPLY-01643', value, target_configuration_file)
10231028
_logger.throwing(ex, class_name=self._class_name, method_name=method_name)

core/src/main/python/wlsdeploy/util/model_context.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from wlsdeploy.aliases.wlst_modes import WlstModes
2323
from wlsdeploy.json.json_translator import JsonToPython
2424
from wlsdeploy.logging import platform_logger
25+
from wlsdeploy.util import target_configuration
2526
from wlsdeploy.util import validate_configuration
2627
from wlsdeploy.util.cla_utils import CommandLineArgUtil
2728
from wlsdeploy.util import path_helper
@@ -787,8 +788,7 @@ def get_target_configuration(self):
787788

788789
def get_target_configuration_file(self):
789790
if self._target:
790-
target_path = os.path.join('targets', self._target, 'target.json')
791-
return self._path_helper.find_local_config_path(target_path)
791+
return target_configuration.get_target_configuration_path(self._target)
792792
return None
793793

794794
def get_target(self):

core/src/main/python/wlsdeploy/util/target_configuration.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from wlsdeploy.exception import exception_helper
66
from wlsdeploy.logging.platform_logger import PlatformLogger
77
from wlsdeploy.util import dictionary_utils
8+
from wlsdeploy.util import path_helper
89
from wlsdeploy.util.validate_configuration import VALIDATION_METHODS
910
from wlsdeploy.tool.util.targets import model_crd_helper
1011

@@ -53,6 +54,9 @@
5354
CONFIG_OVERRIDES_SECRETS_METHOD
5455
]
5556

57+
# wko and wko_* targets are translated to current version
58+
WKO_DEFAULT_PREFIX = 'wko4'
59+
5660
# domain home source types and names
5761
DOMAIN_IN_IMAGE_SOURCE_TYPE = 'dii'
5862
MODEL_IN_IMAGE_SOURCE_TYPE = 'mii'
@@ -328,3 +332,21 @@ def _validate_enumerated_field(self, key, value, valid_values, exit_code, target
328332
value, key, ', '.join(valid_values))
329333
self._logger.throwing(ex, class_name=self._class_name, method_name=method_name)
330334
raise ex
335+
336+
337+
def get_target_configuration_path(target_name):
338+
_path_helper = path_helper.get_path_helper()
339+
directory_name = get_target_configuration_key(target_name)
340+
target_config_path = _path_helper.local_join('targets', directory_name, 'target.json')
341+
return _path_helper.find_local_config_path(target_config_path)
342+
343+
344+
def get_target_configuration_key(target_name):
345+
target_key = target_name
346+
if target_name == 'wko':
347+
target_key = WKO_DEFAULT_PREFIX
348+
349+
if target_name.startswith('wko-'):
350+
target_key = WKO_DEFAULT_PREFIX + target_name[3:]
351+
352+
return target_key

core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ WLSDPLY-00913=Supplied local output directory {0} was not valid: {1}
388388
WLSDPLY-00914=Verrazzano product key {0} used by target {1} has been deprecated, and will be removed in a future release
389389
WLSDPLY-00915=Specified discover security provider data scope was empty or null
390390
WLSDPLY-00916=Unrecognized scopes specified in discover security provider data scope ({0}): {1}
391+
WLSDPLY-00917=Using default configuration {0} for target {1}
391392

392393
# wlsdeploy/util/cla_helper.py
393394

core/src/test/python/wlsdeploy/tool/extract/extract_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2021, 2023, Oracle and/or its affiliates.
2+
Copyright (c) 2021, 2024, Oracle and/or its affiliates.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
"""
55
import os
@@ -44,12 +44,12 @@ def testDefaultModel(self):
4444
are incorporated into the resulting domain resource file.
4545
"""
4646
# Configure the target to set cluster replicas
47-
target_path = os.path.join(self.config_dir, 'targets', 'wko', 'target.json')
47+
target_path = os.path.join(self.config_dir, 'targets', 'wko3', 'target.json')
4848
config = JsonToPython(target_path).parse()
4949
config['set_cluster_replicas'] = True
5050
PythonToJson(config).write_to_json_file(target_path)
5151

52-
documents = self._extract_resource_documents('1', 'wko', 'wko-domain.yaml')
52+
documents = self._extract_resource_documents('1', 'wko3', 'wko-domain.yaml')
5353
resource = documents[0]
5454

5555
# clusters from topology should be in the domain resource file
@@ -71,7 +71,7 @@ def testKubernetesModel(self):
7171
Test that fields from the kubernetes section of the model
7272
are transferred to the resulting domain resource file
7373
"""
74-
documents = self._extract_resource_documents('2', 'wko', 'wko-domain.yaml')
74+
documents = self._extract_resource_documents('2', 'wko3', 'wko-domain.yaml')
7575
resource = documents[0]
7676

7777
# clusters from kubernetes section should be in the domain resource file

0 commit comments

Comments
 (0)