@@ -685,6 +685,11 @@ def get_wlst_mbean_type_for_location(self, location):
685
685
"""
686
686
_method_name = 'get_wlst_mbean_type_for_location'
687
687
688
+ # some callers use this method to check for location valid.
689
+ # they should call is_model_location_valid(location) directly instead.
690
+ if not self .is_model_location_valid (location ):
691
+ return None
692
+
688
693
_logger .entering (str (location ), class_name = _class_name , method_name = _method_name )
689
694
folder_dict = self .__get_dictionary_for_location (location , False )
690
695
if folder_dict is None :
@@ -907,6 +912,21 @@ def is_valid_model_attribute_name_for_location(self, location, model_attribute_n
907
912
_logger .exiting (class_name = _class_name , method_name = _method_name , result = [result , valid_version_range ])
908
913
return result , valid_version_range
909
914
915
+ def is_model_location_valid (self , location ):
916
+ """
917
+ Determine if the specified location is valid, including version/mode checks.
918
+ Returns a boolean answer instead of the (ValidationCode, message) tuple used elsewhere.
919
+ :param location: the location to be checked
920
+ :return: True if the location is valid, false otherwise
921
+ """
922
+ if len (location .get_model_folders ()) > 0 :
923
+ parent_location = LocationContext (location )
924
+ folder = parent_location .pop_location ()
925
+ code , message = self .is_valid_model_folder_name_for_location (parent_location , folder )
926
+ if code != ValidationCodes .VALID :
927
+ return False
928
+ return True
929
+
910
930
def get_folder_short_name_for_location (self , location ):
911
931
"""
912
932
Retrieve the shortened name for the model folder at the provided location.
@@ -1141,10 +1161,10 @@ def __apply_wlst_context_changes(self, path_name, alias_dict, parent_dict):
1141
1161
"""
1142
1162
_method_name = '__apply_wlst_context_changes'
1143
1163
1144
- #
1145
- # First, determine if this dictionary is even relevant to the current WLS version.
1146
- #
1147
1164
self .__resolve_folder_params (path_name , alias_dict )
1165
+
1166
+ # if folder is not valid for this version/mode of WLS,
1167
+ # add folder to parent_dict UNRESOLVED_FOLDERS_MAP and return None
1148
1168
if not self .__use_alias_dict (path_name , alias_dict , parent_dict ):
1149
1169
return None
1150
1170
@@ -1153,8 +1173,10 @@ def __apply_wlst_context_changes(self, path_name, alias_dict, parent_dict):
1153
1173
result_folders = dict ()
1154
1174
folders = alias_dict [FOLDERS ]
1155
1175
for folder in folders :
1156
- folder_dict = self .__apply_wlst_context_changes (path_name + '/' + folder , folders [folder ], alias_dict )
1157
- result_folders [folder ] = folder_dict
1176
+ folder_dict = self .__apply_wlst_context_changes (path_name + '/' + folder , folders [folder ], result )
1177
+ # if folder_dict is None, this folder was invalid for this version/mode of WLS
1178
+ if folder_dict is not None :
1179
+ result_folders [folder ] = folder_dict
1158
1180
result [FOLDERS ] = result_folders
1159
1181
1160
1182
if FLATTENED_FOLDER_DATA in alias_dict :
0 commit comments