18
18
from wlsdeploy .aliases .wlst_modes import WlstModes
19
19
from wlsdeploy .exception .expection_types import ExceptionType
20
20
from wlsdeploy .exception import exception_helper
21
+ from wlsdeploy .logging .platform_logger import PlatformLogger
21
22
from wlsdeploy .tool .create import wlsroles_helper
22
23
from wlsdeploy .tool .util .archive_helper import ArchiveHelper
23
24
from wlsdeploy .tool .validate import validation_utils
40
41
41
42
_class_name = 'Validator'
42
43
_logger = ValidatorLogger ('wlsdeploy.validate' )
44
+ _info_logger = PlatformLogger ('wlsdeploy.validate' )
43
45
_ModelNodeTypes = Enum (['FOLDER_TYPE' , 'NAME_TYPE' , 'ATTRIBUTE' , 'ARTIFICIAL_TYPE' ])
44
46
_ValidationModes = Enum (['STANDALONE' , 'TOOL' ])
45
47
_ROOT_LEVEL_VALIDATION_AREA = validation_utils .format_message ('WLSDPLY-05000' )
@@ -412,8 +414,7 @@ def __validate_model_section(self, model_section_key, model_dict, valid_section_
412
414
result , message = self ._aliases .is_valid_model_folder_name (validation_location ,
413
415
section_dict_key )
414
416
if result == ValidationCodes .VERSION_INVALID :
415
- # key is a VERSION_INVALID folder
416
- self ._logger .warning ('WLSDPLY-05027' , message , class_name = _class_name , method_name = _method_name )
417
+ self ._log_version_invalid (message , _method_name )
417
418
elif result == ValidationCodes .INVALID :
418
419
self ._logger .severe ('WLSDPLY-05026' , section_dict_key , 'folder' , model_folder_path ,
419
420
'%s' % ', ' .join (valid_section_folders ), class_name = _class_name ,
@@ -423,8 +424,7 @@ def __validate_model_section(self, model_section_key, model_dict, valid_section_
423
424
result , message = self ._aliases .is_valid_model_attribute_name (attribute_location ,
424
425
section_dict_key )
425
426
if result == ValidationCodes .VERSION_INVALID :
426
- self ._logger .warning ('WLSDPLY-05027' , message , class_name = _class_name ,
427
- method_name = _method_name )
427
+ self ._log_version_invalid (message , _method_name )
428
428
elif result == ValidationCodes .INVALID :
429
429
self ._logger .severe ('WLSDPLY-05029' , section_dict_key , model_folder_path ,
430
430
'%s' % ', ' .join (valid_attr_infos ), class_name = _class_name ,
@@ -440,7 +440,7 @@ def __validate_section_folder(self, model_node, validation_location):
440
440
441
441
result , message = self ._aliases .is_version_valid_location (validation_location )
442
442
if result == ValidationCodes .VERSION_INVALID :
443
- self ._logger . warning ( 'WLSDPLY-05027' , message , class_name = _class_name , method_name = _method_name )
443
+ self ._log_version_invalid ( message , _method_name )
444
444
return
445
445
elif result == ValidationCodes .INVALID :
446
446
self ._logger .severe ('WLSDPLY-05027' , message , class_name = _class_name , method_name = _method_name )
@@ -623,8 +623,7 @@ def __process_model_node(self, model_node, validation_location):
623
623
# See if it's a version invalid folder
624
624
result , message = self ._aliases .is_valid_model_folder_name (validation_location , key )
625
625
if result == ValidationCodes .VERSION_INVALID :
626
- # key is a VERSION_INVALID folder
627
- self ._logger .warning ('WLSDPLY-05027' , message , class_name = _class_name , method_name = _method_name )
626
+ self ._log_version_invalid (message , _method_name )
628
627
elif result == ValidationCodes .INVALID :
629
628
# key is an INVALID folder
630
629
self ._logger .severe ('WLSDPLY-05026' , key , 'folder' , model_folder_path ,
@@ -638,8 +637,7 @@ def __process_model_node(self, model_node, validation_location):
638
637
# See if it's a version invalid attribute
639
638
result , message = self ._aliases .is_valid_model_attribute_name (validation_location , key )
640
639
if result == ValidationCodes .VERSION_INVALID :
641
- # key is a VERSION_INVALID attribute
642
- self ._logger .warning ('WLSDPLY-05027' , message , class_name = _class_name , method_name = _method_name )
640
+ self ._log_version_invalid (message , _method_name )
643
641
elif result == ValidationCodes .INVALID :
644
642
# key is an INVALID attribute
645
643
self ._logger .severe ('WLSDPLY-05029' , key , model_folder_path ,
@@ -695,7 +693,7 @@ def __validate_attribute(self, attribute_name, attribute_value, valid_attr_infos
695
693
else :
696
694
result , message = self ._aliases .is_valid_model_attribute_name (validation_location , attribute_name )
697
695
if result == ValidationCodes .VERSION_INVALID :
698
- self ._logger . warning ( 'WLSDPLY-05027' , message , class_name = _class_name , method_name = _method_name )
696
+ self ._log_version_invalid ( message , _method_name )
699
697
elif result == ValidationCodes .INVALID :
700
698
self ._logger .severe ('WLSDPLY-05029' , attribute_name , model_folder_path ,
701
699
'%s' % ', ' .join (valid_attr_infos ), class_name = _class_name ,
@@ -935,3 +933,18 @@ def _report_unsupported_variable_usage(self, tokenized_value, model_folder_path)
935
933
for token in tokens :
936
934
self ._logger .severe ('WLSDPLY-05030' , model_folder_path , token ,
937
935
class_name = _class_name , method_name = _method_name )
936
+
937
+ def _log_version_invalid (self , message , method_name ):
938
+ """
939
+ Log a message indicating that an attribute is not valid for the current WLS version and WLST mode.
940
+ Log INFO if validation method is "lax", otherwise log WARNING.
941
+ """
942
+ if self ._model_context .is_targetted_config ():
943
+ validation_method = self ._model_context .get_target_configuration ().get_validation_method ()
944
+ else :
945
+ validation_method = self ._model_context .get_validation_method ()
946
+
947
+ log_method = self ._logger .warning
948
+ if validation_method == 'lax' :
949
+ log_method = _info_logger .info
950
+ log_method ('WLSDPLY-05027' , message , class_name = _class_name , method_name = method_name )
0 commit comments