3434import oracle .weblogic .deploy .util .TranslateException as TranslateException
3535from wlsdeploy .aliases import alias_utils
3636from wlsdeploy .aliases .alias_constants import ALIAS_LIST_TYPES
37+ from wlsdeploy .aliases .alias_constants import PROPERTIES
3738from wlsdeploy .aliases .aliases import Aliases
3839from wlsdeploy .aliases .location_context import LocationContext
3940from wlsdeploy .aliases .model_constants import KUBERNETES
@@ -253,15 +254,18 @@ def calculate_changed_model(self):
253254
254255 def _parse_change_path (self , path ):
255256 """
256- Determine the location and attribute name (if specified) for the specified change path
257+ Determine the location and attribute name (if specified) for the specified change path.
258+ Include a property key for property attribute paths.
257259 :param path: delimited change path, such as "resources|JDBCSystemResource|Generic2|JdbcResource"
258- :return: tuple - location for path, attribute name from path or None
260+ :return: tuple - ( location from path, attribute name from path, property key from path)
259261 """
260262 _method_name = '_parse_change_path'
261263
262264 location = LocationContext ()
263265 attribute_name = None
266+ property_key = None
264267 name_token_next = False
268+ property_key_next = False
265269
266270 path_tokens = path .split (PATH_TOKEN )
267271 folder_names = self .aliases .get_model_section_top_level_folder_names (path_tokens [0 ])
@@ -279,6 +283,8 @@ def _parse_change_path(self, path):
279283 token_name = self .aliases .get_name_token (location )
280284 location .add_name_token (token_name , path_token )
281285 name_token_next = False
286+ elif property_key_next :
287+ property_key = path_token
282288 elif path_token in folder_names :
283289 location .append_location (path_token )
284290 folder_names = self .aliases .get_model_subfolder_names (location )
@@ -294,13 +300,16 @@ def _parse_change_path(self, path):
294300 location .add_name_token (token_name , "TOKEN" )
295301 elif path_token in attribute_names :
296302 attribute_name = path_token
303+ attribute_type = self .aliases .get_model_attribute_type (location , attribute_name )
304+ if attribute_type == PROPERTIES :
305+ property_key_next = True
297306 name_token_next = False
298307 else :
299308 ex = exception_helper .create_compare_exception ('WLSDPLY-05712' , path_token , path )
300309 _logger .throwing (ex , class_name = _class_name , method_name = _method_name )
301310 raise ex
302311
303- return location , attribute_name
312+ return location , attribute_name , property_key
304313
305314 def _add_results (self , change_paths , is_delete = False ):
306315 """
@@ -312,7 +321,7 @@ def _add_results(self, change_paths, is_delete=False):
312321 for change_path in change_paths :
313322 # change_path is the keys of changes in the piped format, such as:
314323 # resources|JDBCSystemResource|Generic2|JdbcResource|JDBCConnectionPoolParams|TestConnectionsOnReserve
315- location , attribute_name = self ._parse_change_path (change_path )
324+ location , attribute_name , property_key = self ._parse_change_path (change_path )
316325 is_folder_path = attribute_name is None
317326
318327 if is_delete and not is_folder_path :
@@ -361,10 +370,13 @@ def _add_results(self, change_paths, is_delete=False):
361370 if current_folder :
362371 current_value = current_folder [key ]
363372 previous_value = dictionary_utils .get_element (previous_folder , key )
364- change_value , comment = self ._get_change_info (current_value , previous_value , location , attribute_name )
373+ change_value , comment = self ._get_change_info (current_value , previous_value , location , attribute_name ,
374+ property_key )
365375
366376 if comment :
367- change_folder [COMMENT_MATCH ] = comment
377+ # make comment key unique, key will not appear in output
378+ comment_key = COMMENT_MATCH + comment
379+ change_folder [comment_key ] = comment
368380 change_folder [key ] = change_value
369381 else :
370382 change_folder [key ] = None
@@ -397,13 +409,14 @@ def _add_results(self, change_paths, is_delete=False):
397409 else :
398410 pointer_dict [parent_key ]['!' + app_key ] = PyOrderedDict ()
399411
400- def _get_change_info (self , current_value , previous_value , location , attribute_name ):
412+ def _get_change_info (self , current_value , previous_value , location , attribute_name , property_key ):
401413 """
402414 Determine the value and comment to put in the change model based on the supplied arguments.
403415 :param current_value: the current value from the new model
404416 :param previous_value: the previous value from the old model
405417 :param location: the location of the value in the model
406418 :param attribute_name: the name of the attribute, or None if this is a folder path
419+ :param property_key: a key in a property value, or None if a different type
407420 :return: a tuple with the change value and comment, either can be None
408421 """
409422 change_value = current_value
@@ -430,6 +443,8 @@ def _get_change_info(self, current_value, previous_value, location, attribute_na
430443 current_text = ',' .join (current_list )
431444 previous_text = ',' .join (previous_list )
432445 comment = attribute_name + ": '" + previous_text + "' -> '" + current_text + "'"
446+ elif attribute_type == PROPERTIES :
447+ comment = property_key + ": '" + str (previous_value ) + "'"
433448 elif not isinstance (previous_value , dict ):
434449 comment = attribute_name + ": '" + str (previous_value ) + "'"
435450
0 commit comments