Skip to content

Commit db2943c

Browse files
Merge branch 'master' of github.com:oracle/weblogic-deploy-tooling
2 parents b7b848e + 8eeea2e commit db2943c

File tree

10 files changed

+188
-24
lines changed

10 files changed

+188
-24
lines changed

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

Lines changed: 6 additions & 2 deletions
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

Lines changed: 8 additions & 4 deletions
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

Lines changed: 12 additions & 7 deletions
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

Lines changed: 1 addition & 0 deletions
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/main/python/wlsdeploy/tool/util/attribute_setter.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,15 +312,17 @@ def set_server_template_mbean(self, location, key, value, wlst_value):
312312

313313
def set_cluster_mbean(self, location, key, value, wlst_value):
314314
"""
315-
Set the Cluster MBean.
315+
assign the Cluster MBean.
316316
:param location: the location
317317
:param key: the attribute name
318318
:param value: the string value
319319
:param wlst_value: the existing value of the attribute from WLST
320320
:raises BundleAwareException of the specified type: if the cluster is not found
321321
"""
322-
mbean = self.__find_in_location(LocationContext(), CLUSTER, value, required=True)
323-
self.set_attribute(location, key, mbean, wlst_merge_value=wlst_value, use_raw_value=True)
322+
323+
entity_type, entity_name = self.__alias_helper.get_model_type_and_name(location)
324+
325+
self.__wlst_helper.assign(entity_type, entity_name, key, value)
324326
return
325327

326328
def set_coherence_cluster_mbean(self, location, key, value, wlst_value):

core/src/main/python/wlsdeploy/tool/util/wlst_helper.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,27 @@ def __init__(self, logger, exception_type):
2020
self.__exception_type = exception_type
2121
return
2222

23+
def assign(self, source_type, source_name, target_type, target_name):
24+
"""
25+
Assign target entity to source entity
26+
:param source_type: source entity type
27+
:param source_name: entity name
28+
:param target_type: target type
29+
:param target_name: target name
30+
:raises: BundleAwareException of the specified type: if an error occurs
31+
"""
32+
33+
_method_name = 'assign'
34+
35+
try:
36+
wlst_helper.assign(source_type, source_name, target_type, target_name)
37+
except PyWLSTException, pwe:
38+
ex = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-19100',
39+
source_type, source_name, target_type, target_name,
40+
pwe.getLocalizedMessage(), error=pwe)
41+
self.__logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
42+
raise ex
43+
2344
def cd(self, wlst_path):
2445
"""
2546
Change WLST directories to the specified path

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,32 @@
1414
_class_name = 'wlst_helper'
1515

1616

17+
def assign(source_type, source_name, target_type, target_name):
18+
"""
19+
Assign target entity to source entity
20+
21+
:param source_type: source entity type
22+
:param source_name: entity name
23+
:param target_type: target type
24+
:param target_name: target name
25+
:raises: PyWLSTException: if a WLST error occurs
26+
"""
27+
28+
_method_name = 'assign'
29+
_logger.finest('WLSDPLY-00001', source_type, source_name, target_type, target_name, class_name=_class_name,
30+
method_name=_method_name)
31+
32+
try:
33+
wlst.assign(source_type, source_name, target_type, target_name)
34+
except (wlst.WLSTException, offlineWLSTException), e:
35+
raise exception_helper.create_pywlst_exception('WLSDPLY-00002', source_type, source_name, target_type,
36+
target_name, _get_exception_mode(e),
37+
_format_exception(e), error=e)
38+
_logger.finest('WLSDPLY-00003', source_type, source_name, target_type, target_name, class_name=_class_name,
39+
method_name=_method_name)
40+
return
41+
42+
1743
def cd(path):
1844
"""
1945
Change location to the provided path.

core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/Server.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@
13531353
"ClasspathServletDisabled": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ClasspathServletDisabled", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean" } ],
13541354
"ClasspathServletSecureModeEnabled": [ {"version": "[12.2.1.3,)", "wlst_mode": "both", "wlst_name": "ClasspathServletSecureModeEnabled", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean" } ],
13551355
"ClientCertProxyEnabled": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ClientCertProxyEnabled", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean" } ],
1356-
"Cluster": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Cluster", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA", "set_method": "${:MBEAN.set_cluster_mbean}", "set_mbean_type": "${:weblogic.management.configuration.ClusterMBean}" } ],
1356+
"Cluster": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Cluster", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA", "set_method": "${MBEAN.set_cluster_mbean:MBEAN.set_cluster_mbean}", "set_mbean_type": "${:weblogic.management.configuration.ClusterMBean}" } ],
13571357
"ClusterWeight": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ClusterWeight", "wlst_path": "WP001", "value": {"default": 100 }, "wlst_type": "integer" } ],
13581358
"CoherenceClusterSystemResource": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "CoherenceClusterSystemResource", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA", "set_method": "${:MBEAN.set_coherence_cluster_mbean}", "set_mbean_type": "${:weblogic.management.configuration.CoherenceClusterSystemResourceMBean}" } ],
13591359
"CompleteCOMMessageTimeout": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "CompleteCOMMessageTimeout", "wlst_path": "WP001", "value": {"default": -1 }, "wlst_type": "integer" } ],

core/src/main/typedefs/RestrictedJRF.json

Lines changed: 93 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,107 @@
55
"description": "Restricted JRF type domain definitions",
66
"versions": {
77
"12.2.1": "RJRF_12CR2",
8+
"12.2.1.3": "RJRF_12213",
89
"19.1": "RJRF_19CR1"
910
},
1011
"definitions": {
1112
"RJRF_12CR2": {
1213
"baseTemplate": "Basic WebLogic Server Domain",
13-
"extensionTemplates": [ "Oracle Enterprise Manager-Restricted JRF" ],
14-
"serverGroupsToTarget": [ "JRF-MAN-SVR" ],
15-
"rcuSchemas": [ "MDS", "IAU", "IAU_VIEWER", "IAU_APPEND", "OPSS"]
14+
"extensionTemplates": [ "Oracle Restricted JRF", "Oracle Enterprise Manager-Restricted JRF" ],
15+
"serverGroupsToTarget": [ "JRF-MAN-SVR", "WSM-CACHE-SVR", "JRF-WS-CORE-MAN-SVR"],
16+
"rcuSchemas": [ ]
17+
},
18+
"RJRF_12213": {
19+
"baseTemplate": "Basic WebLogic Server Domain",
20+
"extensionTemplates": [ "Oracle Restricted JRF", "Oracle Enterprise Manager-Restricted JRF" ],
21+
"serverGroupsToTarget": [ "JRF-MAN-SVR", "WSM-CACHE-SVR", "JRF-WS-CORE-MAN-SVR" ],
22+
"rcuSchemas": [ ]
1623
},
1724
"RJRF_19CR1": {
1825
"baseTemplate": "Basic WebLogic Server Domain",
19-
"extensionTemplates": [ "Oracle Enterprise Manager-Restricted JRF" ],
20-
"serverGroupsToTarget": [ "JRF-MAN-SVR" ],
21-
"rcuSchemas": [ "MDS", "IAU", "IAU_VIEWER", "IAU_APPEND", "OPSS"]
26+
"extensionTemplates": [ "Oracle Restricted JRF", "Oracle Enterprise Manager-Restricted JRF"],
27+
"serverGroupsToTarget": [ "JRF-MAN-SVR", "WSM-CACHE-SVR", "JRF-WS-CORE-MAN-SVR" ],
28+
"rcuSchemas": [ ]
2229
}
30+
},
31+
"system-elements": {
32+
"apps": [
33+
"coherence-transaction-rar",
34+
"DMS Application%%",
35+
"em",
36+
"opss-rest",
37+
"state-management-provider-memory-rar",
38+
"wsil-wls",
39+
"wsm-pm"
40+
],
41+
"coherence-clusters": [
42+
"defaultCoherenceCluster"
43+
],
44+
"shared-libraries": [
45+
"adf.oracle.businesseditor%%",
46+
"adf.oracle.domain%%",
47+
"adf.oracle.domain.webapp%%",
48+
"em_common%%",
49+
"em_core_ppc_pojo_jar",
50+
"em_error%%",
51+
"em_sdkcore_ppc_public_pojo_jar",
52+
"emagentsdk_jar%%",
53+
"emagentsdkimpl_jar%%",
54+
"emagentsdkimplpriv_jar%%",
55+
"emas",
56+
"emcore",
57+
"emcore_jar",
58+
"emcoreclient_jar",
59+
"emcorecommon_jar",
60+
"emcoreconsole_jar",
61+
"emcoreintsdk_jar%%",
62+
"emcorepbs_jar",
63+
"emcoresdk_jar%%",
64+
"emcoresdkimpl_jar%%",
65+
"jsf%%",
66+
"jstl%%",
67+
"log4j_jar%%",
68+
"odl.clickhistory%%",
69+
"odl.clickhistory.webapp%%",
70+
"ohw-rcf%%",
71+
"ohw-uix%%",
72+
"oracle.adf.dconfigbeans%%",
73+
"oracle.adf.desktopintegration%%",
74+
"oracle.adf.desktopintegration.model%%",
75+
"oracle.adf.management%%",
76+
"oracle.bi.adf.model.slib%%",
77+
"oracle.bi.adf.view.slib%%",
78+
"oracle.bi.adf.webcenter.slib%%",
79+
"oracle.bi.composer%%",
80+
"oracle.bi.jbips%%",
81+
"oracle.dconfig-infra%%",
82+
"oracle.jrf.system.filter",
83+
"oracle.jsp.next%%",
84+
"oracle.pwdgen%%",
85+
"oracle.sdp.client%%",
86+
"oracle.sdp.messaging%%",
87+
"oracle.webcenter.composer%%",
88+
"oracle.webcenter.skin%%",
89+
"oracle.wsm.console%%",
90+
"oracle.wsm.idmrest%%",
91+
"oracle.wsm.seedpolicies%%",
92+
"orai18n-adf%%",
93+
"owasp.esapi%%",
94+
"UIX%%"
95+
],
96+
"shutdown-classes": [
97+
"DMSShutdown"
98+
],
99+
"startup-classes": [
100+
"WSM Startup Class",
101+
"Web Services Startup Class",
102+
"JRF Startup Class",
103+
"ODL-Startup",
104+
"DMS-Startup",
105+
"AWT Application Context Startup Class"
106+
],
107+
"wldf": [
108+
"Module-FMWDFW"
109+
]
23110
}
24111
}

core/src/test/python/aliases_test.py

Lines changed: 15 additions & 1 deletion
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)