Skip to content

Commit a5ebd4c

Browse files
committed
Merge branch 'is_set_with_argument' into 'main'
Use isSet with isInConfig argument for upcoming WLS version See merge request weblogic-cloud/weblogic-deploy-tooling!1778
2 parents bc94bd5 + c0cd13d commit a5ebd4c

File tree

4 files changed

+35
-27
lines changed

4 files changed

+35
-27
lines changed

core/src/main/python/wlsdeploy/tool/discover/discoverer.py

-8
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,6 @@ def _uses_is_set(self, location, model_attribute):
240240
"""
241241
return self._aliases.is_derived_default(location, model_attribute)
242242

243-
def _needs_is_set_revision(self, location, model_attribute):
244-
"""
245-
Determine if the attribute value needs revision because it uses the unreliable version of isSet()
246-
:param location: the location of the attribute to be examined
247-
:param model_attribute: the model name of the attribute to be examined
248-
"""
249-
return self._uses_is_set(location, model_attribute) and self._wlst_helper.is_unreliable_is_set()
250-
251243
def _get_attribute_value_with_get(self, wlst_get_param, wlst_path):
252244
_method_name = '_get_attribute_value_with_get'
253245
_logger.finest('WLSDPLY-06104', wlst_get_param, class_name=_class_name, method_name=_method_name)

core/src/main/python/wlsdeploy/tool/discover/topology_discoverer.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,8 @@ def _handle_inherited_default(self, model_name, model_value, location):
10291029
"""
10301030
_method_name = '_handle_inherited_default'
10311031
result = model_value
1032-
if self._needs_is_set_revision(location, model_name):
1032+
offline = self._wlst_mode == WlstModes.OFFLINE
1033+
if offline and self._weblogic_helper.are_offline_inherited_defaults_calculated():
10331034
model_path = location.get_folder_path() + '/' + model_name
10341035
domain_attribute = dictionary_utils.get_element(DOMAIN_INHERITED_DEFAULT_MAPPINGS, model_path)
10351036
if domain_attribute is not None:

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

+18-18
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from wlsdeploy.logging.platform_logger import PlatformLogger
1616
from wlsdeploy.tool.util.string_output_stream import StringOutputStream
1717
import wlsdeploy.util.unicode_helper as str_helper
18+
from wlsdeploy.util.weblogic_helper import WebLogicHelper
1819

1920
wlst_functions = None
2021

@@ -29,6 +30,7 @@ class WlstHelper(object):
2930

3031
def __init__(self, exception_type):
3132
self.__exception_type = exception_type
33+
self.wls_helper = WebLogicHelper(self.__logger)
3234

3335
def get_online_server_version_data(self, username, password, url, timeout):
3436
"""
@@ -164,19 +166,17 @@ def is_set(self, attribute):
164166
mbean_path = self.get_pwd()
165167

166168
try:
167-
if self.is_unreliable_is_set():
168-
# put the value in the model; an att_handler may correct the value
169-
result = True
170-
elif self.__check_online_connection():
169+
# if valid isSet method is not available, return True to include the attribute in the model.
170+
# an att_handler may correct/remove the value after this point.
171+
result = True
172+
173+
if self.__check_online_connection():
171174
mbean = self.get_mbean(mbean_path)
172-
# we may call for every attribute for online + local
173-
if 'isSet' not in dir(mbean):
174-
return True
175-
result = mbean.isSet(attribute)
176-
else:
177-
if not self.__has_global('isSet'):
178-
return True
179-
result = self.__load_global('isSet')(attribute)
175+
if 'isSet' in dir(mbean):
176+
result = mbean.isSet(attribute)
177+
elif self.__uses_is_set_with_argument():
178+
if self.__has_global('isSet'):
179+
result = self.__load_global('isSet')(attribute, isInConfig='true')
180180

181181
except (self.__load_global('WLSTException'), offlineWLSTException), e:
182182
pwe = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-00125', attribute,
@@ -192,15 +192,15 @@ def is_set(self, attribute):
192192
self.__logger.finest('WLSDPLY-00126', attribute, class_name=self.__class_name, method_name=_method_name)
193193
return result
194194

195-
def is_unreliable_is_set(self):
195+
def __uses_is_set_with_argument(self):
196196
"""
197197
Determine if this WLS version's implementation of the WLST isSet() method
198-
is not reliable for deciding to include an attribute value.
199-
Currently, all offline WLS versions that use isSet() (14.1.2+) are not reliable.
200-
Future WLS versions may support a more reliable version of isSet().
201-
:return: True if the implementation of isSet() is unreliable
198+
uses the isInConfig argument for deciding to include an attribute value in the model.
199+
Currently, offline WLS version 15.1.1 and above use this argument.
200+
:return: True if the implementation of isSet() uses the isInConfig argument
202201
"""
203-
return not self.__check_online_connection()
202+
offline = not self.__check_online_connection()
203+
return offline and self.wls_helper.uses_offline_is_set_with_argument()
204204

205205
def set_if_needed(self, wlst_name, wlst_value, masked=False):
206206
"""

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

+15
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,21 @@ def is_secure_mode_implied_by_production_mode(self):
176176
"""
177177
return self.is_weblogic_version_or_above('14.1.2')
178178

179+
def are_offline_inherited_defaults_calculated(self):
180+
"""
181+
Determine if inherited default values need to be calculated.
182+
This is needed for versions of WLS in which the isSet() method does not give a reliable result.
183+
:return: true if version is within the range for this condition. false otherwise
184+
"""
185+
return self.is_weblogic_version_or_above('14.1.2') and not self.uses_offline_is_set_with_argument()
186+
187+
def uses_offline_is_set_with_argument(self):
188+
"""
189+
Does the offline WLST isSet() method use the argument isInConfig for consistent results?
190+
:return: true if version is within the range for this condition. false otherwise
191+
"""
192+
return self.is_weblogic_version_or_above('15.1.1')
193+
179194
def get_jdbc_url_from_rcu_connect_string(self, rcu_connect_string, rcu_database_type='ORACLE'):
180195
"""
181196
Get the JDBC URL from the RCU connect string.

0 commit comments

Comments
 (0)