@@ -48,7 +48,8 @@ def __init__(self, model_context, base_location, wlst_mode, aliases=None):
4848 self ._aliases = Aliases (self ._model_context , wlst_mode = self ._wlst_mode )
4949 self ._alias_helper = AliasHelper (self ._aliases , _logger , ExceptionType .DISCOVER )
5050 self ._att_handler_map = OrderedDict ()
51- self ._wls_version = WebLogicHelper (_logger ).get_actual_weblogic_version ()
51+ self ._weblogic_helper = WebLogicHelper (_logger )
52+ self ._wls_version = self ._weblogic_helper .get_actual_weblogic_version ()
5253 self ._wlst_helper = WlstHelper (_logger , ExceptionType .DISCOVER )
5354
5455 # methods for use only by the subclasses
@@ -100,7 +101,7 @@ def _populate_model_parameters(self, dictionary, location):
100101 wlst_value )
101102 except AliasException , de :
102103 _logger .info ('WLSDPLY-06106' , wlst_param , wlst_path , de .getLocalizedMessage (),
103- class_name = _class_name , method_name = _method_name )
104+ class_name = _class_name , method_name = _method_name )
104105 continue
105106
106107 attr_dict [model_param ] = wlst_value
@@ -167,15 +168,15 @@ def _is_defined_attribute(self, location, wlst_name):
167168 try :
168169 if self ._aliases .get_model_attribute_name (location , wlst_name ):
169170 attribute = True
170- except AliasException , ae :
171+ except AliasException :
171172 pass
172173 return attribute
173174
174175 def _get_required_attributes (self , location ):
175176 """
176177 Use get for all online attributes, and use the attribute names in the
177- :param location:
178- :return:
178+ :param location: current location context
179+ :return: list of attributes that require wlst.get
179180 """
180181 _method_name = '_get_required_attributes'
181182 attributes = []
@@ -240,6 +241,7 @@ def _find_names_in_folder(self, location):
240241 if wlst_helper .path_exists (folder_path ):
241242 self .wlst_cd (folder_path , location )
242243 names = self ._wlst_helper .lsc ()
244+ _logger .finest ('WLSDPLY-06146' , names , location , class_name = _class_name , method_name = _method_name )
243245 return names
244246
245247 def _find_singleton_name_in_folder (self , location ):
@@ -268,6 +270,7 @@ def _find_subfolders(self, location):
268270 return self ._find_subfolders_offline (location )
269271 else :
270272 return self ._find_subfolders_online (location )
273+
271274 def _find_subfolders_offline (self , location ):
272275 """
273276 Find the subfolders of the current location.
@@ -360,18 +363,19 @@ def _discover_artificial_folder(self, model_subfolder_name, location, name_token
360363 names = self ._find_names_in_folder (location )
361364 if names is not None :
362365 for name in names :
363- location .add_name_token (name_token , name )
366+ massaged = self ._inspect_artificial_folder_name (name , location )
367+ location .add_name_token (name_token , massaged )
364368 artificial = self ._get_artificial_type (location )
365369 if artificial is None :
366370 _logger .warning ('WLSDPLY-06123' , self ._alias_helper .get_model_folder_path (location ),
367371 class_name = _class_name , method_name = _method_name )
368372 else :
369- _logger .finer ('WLSDPLY-06120' , artificial , name , model_subfolder_name , class_name = _class_name ,
373+ _logger .finer ('WLSDPLY-06120' , artificial , massaged , model_subfolder_name , class_name = _class_name ,
370374 method_name = _method_name )
371375 location .append_location (artificial )
372- subfolder_result [name ] = OrderedDict ()
373- subfolder_result [name ][artificial ] = OrderedDict ()
374- self ._populate_model_parameters (subfolder_result [name ][artificial ], location )
376+ subfolder_result [massaged ] = OrderedDict ()
377+ subfolder_result [massaged ][artificial ] = OrderedDict ()
378+ self ._populate_model_parameters (subfolder_result [massaged ][artificial ], location )
375379 location .pop_location ()
376380 location .remove_name_token (name_token )
377381 _logger .exiting (class_name = _class_name , method_name = _method_name , result = subfolder_result )
@@ -411,12 +415,13 @@ def _discover_subfolder(self, model_subfolder_name, location, result=None):
411415 """
412416 Discover the subfolder indicated by the model subfolder name. Append the model subfolder to the
413417 current location context, and pop that location before return
414- :param result: dictionary to store the discovered information
418+ :param model_subfolder_name: Name of the model subfolder
415419 :param location: context containing the current subfolder information
416420 :return: discovered dictionary
417421 """
418422 _method_name = '_discover_subfolder'
419- _logger .entering (model_subfolder_name , class_name = _class_name , method_name = _method_name )
423+ _logger .entering (model_subfolder_name , location .get_folder_path (), class_name = _class_name ,
424+ method_name = _method_name )
420425 location .append_location (model_subfolder_name )
421426 _logger .finer ('WLSDPLY-06115' , model_subfolder_name , self ._alias_helper .get_model_folder_path (location ),
422427 class_name = _class_name , method_name = _method_name )
@@ -631,6 +636,27 @@ def wlst_cd(self, path, location):
631636 method_name = _method_name )
632637 return result
633638
639+ def _inspect_artificial_folder_name (self , folder_name , location ):
640+ """
641+ Perform any special handling for the folder or folder names.
642+ :param location: current context of location
643+ :return: Original name or processed name value
644+ """
645+ return self ._inspect_security_folder_name (folder_name , location )
646+
647+ def _inspect_security_folder_name (self , folder_name , location ):
648+ # This is clunky - Some security providers in 11g offline have the name "Provider", and cannot be discovered.
649+ # If found, log and throw an exception here, and the SecurityConfiguration will be omitted from the model.
650+
651+ if (not self ._weblogic_helper .is_version_in_12c ()) and self ._wlst_mode == WlstModes .OFFLINE and \
652+ self ._alias_helper .is_security_provider_type (location ) and 'Provider' == folder_name :
653+ raise exception_helper .create_discover_exception ('WLSDPLY-06201' , folder_name , location .get_folder_path ())
654+
655+ _logger .fine ('version {0} mode {1} type? {2} provider {3}' , not self ._weblogic_helper .is_version_in_12c (),
656+ self ._wlst_mode == WlstModes .OFFLINE , self ._alias_helper .is_security_provider_type (location ),
657+ 'Provider' == folder_name )
658+ return folder_name
659+
634660
635661def add_to_model_if_not_empty (dictionary , entry_name , entry_value ):
636662 """
@@ -640,7 +666,7 @@ def add_to_model_if_not_empty(dictionary, entry_name, entry_value):
640666 :param entry_value: to add to dictionary
641667 :return: True if the value was not empty and added to the dictionary
642668 """
643- if entry_value :
669+ if entry_value and len ( entry_value ) :
644670 dictionary [entry_name ] = entry_value
645671 return True
646672 return False
@@ -694,7 +720,7 @@ def _is_attribute_type(attribute_info):
694720 _method_name = '_is_attribute_type'
695721 if not attribute_info .isWritable () and _is_deprecated (attribute_info ):
696722 _logger .finer ('WLSDPLY-06143' , attribute_info .getName (), wlst_helper .get_pwd (),
697- class_name = _class_name , method_name = _method_name )
723+ class_name = _class_name , method_name = _method_name )
698724 return attribute_info .getDescriptor ().getFieldValue (
699725 'descriptorType' ) == 'Attribute' and attribute_info .getDescriptor ().getFieldValue (
700726 'com.bea.relationship' ) is None and (attribute_info .isWritable () or not _is_deprecated (attribute_info ))
0 commit comments