Skip to content

Commit 8eeea2e

Browse files
Merge pull request #226 from oracle/jira-wdt-9-create-domain-cluster-datasource
Issue #210 JIRA WDT-45 Fix problems with comma-separated server start…
2 parents 24b03c0 + a73bb6d commit 8eeea2e

File tree

5 files changed

+42
-14
lines changed

5 files changed

+42
-14
lines changed

core/src/main/python/wlsdeploy/aliases/alias_jvmargs.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
33
The Universal Permissive License (UPL), Version 1.0
44
"""
55
import copy
@@ -246,7 +246,11 @@ def __parse_args(self):
246246
_method_name = '__parse_args'
247247

248248
if self.__raw_args is not None and len(self.__raw_args) > 0:
249-
arguments = self.__raw_args.split()
249+
if isinstance(self.__raw_args, list):
250+
arguments = self.__raw_args
251+
else:
252+
arguments = self.__raw_args.split()
253+
250254
for argument in arguments:
251255
if self.__client_server_regex.match(argument):
252256
self.__client_server_args.append(argument)

core/src/main/python/wlsdeploy/aliases/alias_utils.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,15 @@
5151
from wlsdeploy.aliases.alias_constants import WLST_READ_TYPE
5252
from wlsdeploy.aliases.alias_constants import WLST_TYPE
5353
from wlsdeploy.aliases.alias_constants import WLST_SUBFOLDERS_PATH
54+
from wlsdeploy.aliases.model_constants import ARGUMENTS
5455
from wlsdeploy.aliases.model_constants import MODEL_LIST_DELIMITER
56+
from wlsdeploy.aliases.model_constants import SERVER
57+
from wlsdeploy.aliases.model_constants import SERVER_START
5558

5659
_class_name = 'alias_utils'
5760
_logger = PlatformLogger('wlsdeploy.aliases')
58-
_server_start_location_folder_path = '/Server/ServerStart'
59-
_server_start_argument_attribute_name = 'Arguments'
61+
_server_start_location_folder_path = '/' + SERVER + '/' + SERVER_START
62+
_server_start_argument_attribute_name = ARGUMENTS
6063
_windows_path_regex = re.compile(r'^[a-zA-Z]:[\\/].*')
6164

6265

@@ -149,7 +152,7 @@ def merge_model_and_existing_properties(model_props, existing_props, string_prop
149152
def merge_server_start_argument_values(model_args, existing_args):
150153
"""
151154
Merge the two arguments strings.
152-
:param model_args: the new string from the model
155+
:param model_args: the new string or list from the model
153156
:param existing_args: the old string (e.g., from WLST)
154157
:return: the resulting merged string
155158
"""
@@ -159,7 +162,8 @@ def merge_server_start_argument_values(model_args, existing_args):
159162
if model_args is None or len(model_args) == 0:
160163
result = existing_args
161164
elif existing_args is None or len(existing_args) == 0:
162-
result = model_args
165+
new_args = JVMArguments(_logger, model_args)
166+
result = new_args.get_arguments_string()
163167
else:
164168
new_args = JVMArguments(_logger, model_args)
165169
merged_args = JVMArguments(_logger, existing_args)

core/src/main/python/wlsdeploy/aliases/aliases.py

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
33
The Universal Permissive License (UPL), Version 1.0
44
"""
55
from java.lang import String
@@ -43,6 +43,7 @@
4343
from wlsdeploy.aliases.alias_constants import RESTART_REQUIRED
4444
from wlsdeploy.aliases.alias_constants import SET_MBEAN_TYPE
4545
from wlsdeploy.aliases.alias_constants import SET_METHOD
46+
from wlsdeploy.aliases.alias_constants import STRING
4647
from wlsdeploy.aliases.alias_constants import USES_PATH_TOKENS
4748
from wlsdeploy.aliases.alias_constants import VALUE
4849
from wlsdeploy.aliases.alias_constants import WLST_NAME
@@ -385,17 +386,21 @@ def get_wlst_attribute_name_and_value(self, location, model_attribute_name, mode
385386
raise ex
386387
else:
387388
if data_type in ALIAS_LIST_TYPES or data_type in ALIAS_MAP_TYPES:
389+
to_type = data_type
390+
388391
merge = True
389392
if MERGE in attribute_info:
390393
merge = alias_utils.convert_boolean(attribute_info[MERGE])
391394

392-
if merge and data_type in ALIAS_MAP_TYPES:
395+
if alias_utils.is_attribute_server_start_arguments(location, model_attribute_name):
396+
# convert to string, even if no existing value to merge
397+
merged_value = \
398+
alias_utils.merge_server_start_argument_values(model_attribute_value, existing_wlst_value)
399+
to_type = STRING
400+
elif merge and data_type in ALIAS_MAP_TYPES:
393401
model_val = TypeUtils.convertToType(PROPERTIES, model_attribute_value)
394402
existing_val = TypeUtils.convertToType(PROPERTIES, existing_wlst_value)
395403
merged_value = alias_utils.merge_model_and_existing_properties(model_val, existing_val)
396-
elif merge and alias_utils.is_attribute_server_start_arguments(location, model_attribute_name):
397-
merged_value = \
398-
alias_utils.merge_server_start_argument_values(model_attribute_value, existing_wlst_value)
399404
elif merge and existing_wlst_value is not None and len(existing_wlst_value) > 0:
400405
model_val = alias_utils.convert_to_type(LIST, model_attribute_value,
401406
delimiter=MODEL_LIST_DELIMITER)
@@ -412,10 +417,10 @@ def get_wlst_attribute_name_and_value(self, location, model_attribute_name, mode
412417
subtype = 'java.lang.String'
413418
if SET_MBEAN_TYPE in attribute_info:
414419
subtype = attribute_info[SET_MBEAN_TYPE]
415-
wlst_attribute_value = alias_utils.convert_to_type(data_type, merged_value, subtype=subtype,
420+
wlst_attribute_value = alias_utils.convert_to_type(to_type, merged_value, subtype=subtype,
416421
delimiter=MODEL_LIST_DELIMITER)
417422
else:
418-
wlst_attribute_value = alias_utils.convert_to_type(data_type, merged_value,
423+
wlst_attribute_value = alias_utils.convert_to_type(to_type, merged_value,
419424
delimiter=MODEL_LIST_DELIMITER)
420425
else:
421426
wlst_attribute_value = alias_utils.convert_to_type(data_type, model_attribute_value,

core/src/main/python/wlsdeploy/aliases/model_constants.py

+1
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@
265265
ABSOLUTE_SOURCE_PATH = 'AbsoluteSourcePath'
266266
ACTION = 'Action'
267267
ACTIVE_TYPE = 'ActiveType'
268+
ARGUMENTS = 'Arguments'
268269
CONSTRAINED_CANDIDATE_SERVER = 'ConstrainedCandidateServer'
269270
CUSTOM_IDENTITY_KEYSTORE_FILE = 'CustomIdentityKeyStoreFileName'
270271
CUSTOM_TRUST_KEYSTORE_FILE = 'CustomTrustKeyStoreFileName'

core/src/test/python/aliases_test.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from oracle.weblogic.deploy.aliases import TypeUtils
1414

1515
from wlsdeploy.aliases.aliases import Aliases
16-
from wlsdeploy.aliases.alias_constants import ATTRIBUTES
1716
from wlsdeploy.aliases.location_context import LocationContext
1817
import wlsdeploy.aliases.model_constants as FOLDERS
1918
from wlsdeploy.aliases.validation_codes import ValidationCodes
@@ -1322,5 +1321,20 @@ def testListGetToList(self):
13221321
actual_attr, actual_value = self.aliases.get_wlst_attribute_name_and_value(location, actual_attr, actual_value)
13231322
self.assertEqual(wlst_list, actual_value)
13241323

1324+
# server start args can be a list in the model, merge values and become a string for WLST
1325+
def testServerStartArgs(self):
1326+
location = LocationContext().append_location(FOLDERS.SERVER)
1327+
location.add_name_token(self.aliases.get_name_token(location), 'AdminServer')
1328+
location = location.append_location(FOLDERS.SERVER_START)
1329+
location.add_name_token(self.aliases.get_name_token(location), 'AdminServer')
1330+
attribute = FOLDERS.ARGUMENTS
1331+
value = ['-Dxyz=123,456,789']
1332+
existing_value = '-Dxyz=123,555,789'
1333+
1334+
dummy_attr, wlst_value = self.aliases.get_wlst_attribute_name_and_value(location, attribute, value,
1335+
existing_value)
1336+
self.assertEqual('-Dxyz=123,456,789', wlst_value)
1337+
1338+
13251339
if __name__ == '__main__':
13261340
unittest.main()

0 commit comments

Comments
 (0)