Skip to content

Commit e04878e

Browse files
Fix folder and reference related online discovery issues
1 parent aab30d0 commit e04878e

File tree

3 files changed

+60
-11
lines changed

3 files changed

+60
-11
lines changed

core/src/main/python/discover.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -428,14 +428,14 @@ def __check_and_customize_model(model, model_context, aliases):
428428
inject_variables_keyword_file()
429429
if inserted:
430430
model = Model(variable_model)
431-
try:
432-
validator = Validator(model_context, wlst_mode=__wlst_mode, aliases=aliases)
433-
434-
# no variables are generated by the discover tool
435-
validator.validate_in_tool_mode(model.get_model(), variables_file_name=variable_file_name,
436-
archive_file_name=model_context.get_archive_file_name())
437-
except ValidateException, ex:
438-
__logger.warning('WLSDPLY-06015', ex.getLocalizedMessage(), class_name=_class_name, method_name=_method_name)
431+
# try:
432+
# validator = Validator(model_context, wlst_mode=__wlst_mode, aliases=aliases)
433+
#
434+
# # no variables are generated by the discover tool
435+
# validator.validate_in_tool_mode(model.get_model(), variables_file_name=variable_file_name,
436+
# archive_file_name=model_context.get_archive_file_name())
437+
# except ValidateException, ex:
438+
# __logger.warning('WLSDPLY-06015', ex.getLocalizedMessage(), class_name=_class_name, method_name=_method_name)
439439
return model
440440

441441

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

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def _populate_model_parameters(self, dictionary, location):
9999
wlst_param,
100100
wlst_value)
101101
except AliasException, de:
102-
_logger.warning('WLSDPLY-06106', wlst_param, wlst_path, de.getLocalizedMessage(),
102+
_logger.info('WLSDPLY-06106', wlst_param, wlst_path, de.getLocalizedMessage(),
103103
class_name=_class_name, method_name=_method_name)
104104
continue
105105

@@ -264,6 +264,11 @@ def _find_singleton_name_in_folder(self, location):
264264
return name
265265

266266
def _find_subfolders(self, location):
267+
if self._wlst_mode == WlstModes.OFFLINE:
268+
return self._find_subfolders_offline(location)
269+
else:
270+
return self._find_subfolders_online(location)
271+
def _find_subfolders_offline(self, location):
267272
"""
268273
Find the subfolders of the current location.
269274
:param location: context containing current location information
@@ -282,6 +287,20 @@ def _find_subfolders(self, location):
282287
wlst_subfolders = new_subfolders
283288
return wlst_subfolders
284289

290+
def _find_subfolders_online(self, location):
291+
wlst_path = self._alias_helper.get_wlst_subfolders_path(location)
292+
wlst_subfolders = []
293+
if self.wlst_cd(wlst_path, location):
294+
wlst_subfolders = _massage_online_folders(self._wlst_helper.lsc())
295+
if wlst_subfolders:
296+
new_subfolders = []
297+
for wlst_subfolder in wlst_subfolders:
298+
model_subfolder_name = self._get_model_name(location, wlst_subfolder)
299+
if model_subfolder_name:
300+
new_subfolders.append(wlst_subfolder)
301+
wlst_subfolders = new_subfolders
302+
return wlst_subfolders
303+
285304
def _discover_subfolder_singleton(self, model_subfolder_name, location):
286305
"""
287306
Discover the subfolder from the wlst subfolder name. populate the attributes in the folder.
@@ -655,7 +674,7 @@ def _is_attribute(attributes_info):
655674
def _is_valid_reference(attribute_info):
656675
# check again after all done to see whether need to use get deprecated
657676
return _is_reference(attribute_info) and (
658-
attribute_info.isWritable() is True and not _is_deprecated(attribute_info))
677+
attribute_info.isWritable() or not _is_deprecated(attribute_info))
659678

660679

661680
def _is_reference(mbean_attribute_info):
@@ -667,10 +686,37 @@ def _is_deprecated(mbean_attribute_info):
667686
return deprecated_version is not None and deprecated_version != 'null' and len(deprecated_version) > 1
668687

669688

689+
def _is_containment(mbean_attribute_info):
690+
return mbean_attribute_info.getDescriptor().getFieldValue('com.bea.relationship') == 'containment'
691+
692+
670693
def _is_attribute_type(attribute_info):
694+
_method_name = '_is_attribute_type'
695+
if not attribute_info.isWritable() and _is_deprecated(attribute_info):
696+
_logger.finer('WLSDPLY-06143', attribute_info.getName(), wlst_helper.get_pwd(),
697+
class_name=_class_name, method_name=_method_name)
671698
return attribute_info.getDescriptor().getFieldValue(
672699
'descriptorType') == 'Attribute' and attribute_info.getDescriptor().getFieldValue(
673-
'com.bea.relationship') is None
700+
'com.bea.relationship') is None and (attribute_info.isWritable() or not _is_deprecated(attribute_info))
701+
702+
703+
def _massage_online_folders(lsc_folders):
704+
_method_name = '_massage_online_folders'
705+
location = wlst_helper.get_pwd()
706+
folder_list = []
707+
mbi_folder_list = []
708+
for mbean_attribute_info in wlst_helper.get_mbi().getAttributes():
709+
if _is_containment(mbean_attribute_info):
710+
mbi_folder_list.append(mbean_attribute_info.getName())
711+
for lsc_folder in lsc_folders:
712+
if lsc_folder in mbi_folder_list:
713+
folder_list.append(lsc_folder)
714+
else:
715+
_logger.finer('WLSDPLY-06144', lsc_folder, location, class_name=_class_name, method_name=_method_name)
716+
if len(folder_list) != len(mbi_folder_list):
717+
_logger.fine('WLSDPLY-06145', folder_list, location, mbi_folder_list, class_name=_class_name,
718+
method_name=_method_name)
719+
return folder_list
674720

675721

676722
def get_discover_logger_name():

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
@@ -461,6 +461,9 @@ WLSDPLY-06140=Unable to cd to the expected path {0} constructed from location co
461461
and its sub-folders cannot be discovered : {2}
462462
WLSDPLY-06141=Add online attribute {0} and value to the current attribute lsa() list
463463
WLSDPLY-06142=The online attribute {0} is in the lsa() list but is a folder not an attribute
464+
WLSDPLY-06143=Attribute {0} at location {1} is not writable and is deprecated
465+
WLSDPLY-06144=Folder {0} at location {1} is not an online folder. Removing from online subfolder list
466+
WLSDPLY-06145=Subfolder list {0} at location {1} does not match the mbi containment folder list {2}
464467

465468
# resources_discoverer.py
466469
WLSDPLY-06300=Discovering domain model resources

0 commit comments

Comments
 (0)