@@ -48,7 +48,8 @@ def __init__(self, model_context, base_location, wlst_mode, aliases=None):
48
48
self ._aliases = Aliases (self ._model_context , wlst_mode = self ._wlst_mode )
49
49
self ._alias_helper = AliasHelper (self ._aliases , _logger , ExceptionType .DISCOVER )
50
50
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 ()
52
53
self ._wlst_helper = WlstHelper (_logger , ExceptionType .DISCOVER )
53
54
54
55
# methods for use only by the subclasses
@@ -100,7 +101,7 @@ def _populate_model_parameters(self, dictionary, location):
100
101
wlst_value )
101
102
except AliasException , de :
102
103
_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 )
104
105
continue
105
106
106
107
attr_dict [model_param ] = wlst_value
@@ -167,15 +168,15 @@ def _is_defined_attribute(self, location, wlst_name):
167
168
try :
168
169
if self ._aliases .get_model_attribute_name (location , wlst_name ):
169
170
attribute = True
170
- except AliasException , ae :
171
+ except AliasException :
171
172
pass
172
173
return attribute
173
174
174
175
def _get_required_attributes (self , location ):
175
176
"""
176
177
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
179
180
"""
180
181
_method_name = '_get_required_attributes'
181
182
attributes = []
@@ -240,6 +241,7 @@ def _find_names_in_folder(self, location):
240
241
if wlst_helper .path_exists (folder_path ):
241
242
self .wlst_cd (folder_path , location )
242
243
names = self ._wlst_helper .lsc ()
244
+ _logger .finest ('WLSDPLY-06146' , names , location , class_name = _class_name , method_name = _method_name )
243
245
return names
244
246
245
247
def _find_singleton_name_in_folder (self , location ):
@@ -268,6 +270,7 @@ def _find_subfolders(self, location):
268
270
return self ._find_subfolders_offline (location )
269
271
else :
270
272
return self ._find_subfolders_online (location )
273
+
271
274
def _find_subfolders_offline (self , location ):
272
275
"""
273
276
Find the subfolders of the current location.
@@ -360,18 +363,19 @@ def _discover_artificial_folder(self, model_subfolder_name, location, name_token
360
363
names = self ._find_names_in_folder (location )
361
364
if names is not None :
362
365
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 )
364
368
artificial = self ._get_artificial_type (location )
365
369
if artificial is None :
366
370
_logger .warning ('WLSDPLY-06123' , self ._alias_helper .get_model_folder_path (location ),
367
371
class_name = _class_name , method_name = _method_name )
368
372
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 ,
370
374
method_name = _method_name )
371
375
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 )
375
379
location .pop_location ()
376
380
location .remove_name_token (name_token )
377
381
_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):
411
415
"""
412
416
Discover the subfolder indicated by the model subfolder name. Append the model subfolder to the
413
417
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
415
419
:param location: context containing the current subfolder information
416
420
:return: discovered dictionary
417
421
"""
418
422
_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 )
420
425
location .append_location (model_subfolder_name )
421
426
_logger .finer ('WLSDPLY-06115' , model_subfolder_name , self ._alias_helper .get_model_folder_path (location ),
422
427
class_name = _class_name , method_name = _method_name )
@@ -631,6 +636,27 @@ def wlst_cd(self, path, location):
631
636
method_name = _method_name )
632
637
return result
633
638
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
+
634
660
635
661
def add_to_model_if_not_empty (dictionary , entry_name , entry_value ):
636
662
"""
@@ -640,7 +666,7 @@ def add_to_model_if_not_empty(dictionary, entry_name, entry_value):
640
666
:param entry_value: to add to dictionary
641
667
:return: True if the value was not empty and added to the dictionary
642
668
"""
643
- if entry_value :
669
+ if entry_value and len ( entry_value ) :
644
670
dictionary [entry_name ] = entry_value
645
671
return True
646
672
return False
@@ -694,7 +720,7 @@ def _is_attribute_type(attribute_info):
694
720
_method_name = '_is_attribute_type'
695
721
if not attribute_info .isWritable () and _is_deprecated (attribute_info ):
696
722
_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 )
698
724
return attribute_info .getDescriptor ().getFieldValue (
699
725
'descriptorType' ) == 'Attribute' and attribute_info .getDescriptor ().getFieldValue (
700
726
'com.bea.relationship' ) is None and (attribute_info .isWritable () or not _is_deprecated (attribute_info ))
0 commit comments