Skip to content

Commit 30d32e9

Browse files
authored
Avoid default JNDI name list for merge (#665)
* JIRA WDT-426 Use "weblogic" and "password1" for placeholders * Issue #660 - Avoid merging values that are not set in online update
1 parent f3b9c5b commit 30d32e9

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

core/src/main/python/wlsdeploy/tool/deploy/deployer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@ def _get_existing_wlst_value(self, location, key, lsa_required_attribute_names):
228228
if wlst_key is None:
229229
return None
230230

231+
# online WLST may return a default value, even if the attribute was not set.
232+
# don't merge with a value that was not set (example: JDBCDataSourceParams: JNDINames).
233+
if not self.wlst_helper.is_set(wlst_key):
234+
return None
235+
231236
if key in lsa_required_attribute_names:
232237
attribute_map = self.wlst_helper.lsa()
233238
if wlst_key in attribute_map:

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,34 @@ def get(self, attribute):
9494
self.__logger.finest('WLSDPLY-00006', attribute, class_name=self.__class_name, method_name=_method_name)
9595
return result
9696

97+
def is_set(self, attribute):
98+
"""
99+
Determine if the specified attribute has been set.
100+
In online WLST, attributes may return values that did not originate in config.xml (not set).
101+
For offline WLST, return True always.
102+
:param attribute: name of the WLST attribute
103+
:return: True if the value has been set or in offline mode, False otherwise
104+
:raises: Exception for the specified tool type: if a WLST error occurs
105+
"""
106+
_method_name = 'is_set'
107+
self.__logger.finest('WLSDPLY-00124', attribute, class_name=self.__class_name, method_name=_method_name)
108+
109+
if not self.__check_online_connection():
110+
return True
111+
112+
try:
113+
mbean_path = self.get_pwd()
114+
mbean = self.get_mbean_for_wlst_path(mbean_path)
115+
result = mbean.isSet(attribute)
116+
except (self.__load_global('WLSTException'), offlineWLSTException), e:
117+
pwe = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-00125', attribute,
118+
self.__get_exception_mode(e), _format_exception(e), error=e)
119+
self.__logger.throwing(class_name=self.__class_name, method_name=_method_name, error=pwe)
120+
raise pwe
121+
122+
self.__logger.finest('WLSDPLY-00126', attribute, class_name=self.__class_name, method_name=_method_name)
123+
return result
124+
97125
def set_if_needed(self, wlst_name, wlst_value, masked=False):
98126
"""
99127
Set the WLST attribute to the specified value if the name and value are not None.

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ WLSDPLY-0098=Quoted WebLogic String
106106
WLSDPLY-0100=Failed to set attribute {0} in path {1} to value {2}: {3}
107107
WLSDPLY-00101=Failed to modify the bootstrap credentials : {0}
108108
WLSDPLY-00123=Setting the server group {0} on dynamic cluster {1} failed : {2}
109+
WLSDPLY-00124=Entering is_set({0}) method
110+
WLSDPLY-00125=is_set({0}) in {1} mode failed: {2}
111+
WLSDPLY-00126=Exiting is_set({0}) method
109112

110113

111114
###############################################################################

0 commit comments

Comments
 (0)