Skip to content

Commit e9ef1c3

Browse files
Add wlst_mode to the folder level and change NMProperties to offline folder
1 parent 0d182c2 commit e9ef1c3

File tree

2 files changed

+73
-69
lines changed

2 files changed

+73
-69
lines changed

core/src/main/python/wlsdeploy/aliases/alias_entries.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ def get_dictionary_for_location(self, location, resolve=True):
210210

211211
_logger.entering(str(location), class_name=_class_name, method_name=_method_name)
212212
result = self.__get_dictionary_for_location(location, resolve)
213+
# not one caller checks to see if the dictionary returned is None
214+
if result is None:
215+
result = dict()
213216
_logger.exiting(class_name=_class_name, method_name=_method_name)
214217
return result
215218

core/src/main/python/wlsdeploy/aliases/aliases.py

Lines changed: 70 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -346,81 +346,82 @@ def get_wlst_attribute_name_and_value(self, location, model_attribute_name, mode
346346
if not module_folder:
347347
self._logger.fine('WLSDPLY-08410', location.get_current_model_folder(), location.get_parent_folder_path(),
348348
WlstModes.from_value(self._wlst_mode), self._wls_version)
349-
else:
350-
if ATTRIBUTES not in module_folder:
351-
ex = exception_helper.create_alias_exception('WLSDPLY-08400', location.get_folder_path())
352-
self._logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
353-
raise ex
349+
return wlst_attribute_name, wlst_attribute_value
354350

355-
if model_attribute_name not in module_folder[ATTRIBUTES]:
356-
ex = exception_helper.create_alias_exception('WLSDPLY-08401', model_attribute_name,
357-
location.get_folder_path())
358-
self._logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
359-
raise ex
351+
if ATTRIBUTES not in module_folder:
352+
ex = exception_helper.create_alias_exception('WLSDPLY-08400', location.get_folder_path())
353+
self._logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
354+
raise ex
360355

361-
attribute_info = module_folder[ATTRIBUTES][model_attribute_name]
356+
if model_attribute_name not in module_folder[ATTRIBUTES]:
357+
ex = exception_helper.create_alias_exception('WLSDPLY-08401', model_attribute_name,
358+
location.get_folder_path())
359+
self._logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
360+
raise ex
362361

363-
if attribute_info and not self.__is_model_attribute_read_only(location, attribute_info):
364-
password_attribute_name = \
365-
password_utils.get_wlst_attribute_name(attribute_info, model_attribute_value, self._wlst_mode)
362+
attribute_info = module_folder[ATTRIBUTES][model_attribute_name]
366363

367-
if password_attribute_name is not None:
368-
wlst_attribute_name = password_attribute_name
369-
else:
370-
wlst_attribute_name = attribute_info[WLST_NAME]
371-
372-
if self._model_context and USES_PATH_TOKENS in attribute_info\
373-
and string_utils.to_boolean(attribute_info[USES_PATH_TOKENS]):
374-
model_attribute_value = self._model_context.replace_token_string(model_attribute_value)
375-
376-
data_type = attribute_info[WLST_TYPE]
377-
if data_type == 'password':
378-
try:
379-
wlst_attribute_value = self.__decrypt_password(model_attribute_value)
380-
except EncryptionException, ee:
381-
ex = exception_helper.create_alias_exception('WLSDPLY-08402', model_attribute_name,
382-
location.get_folder_path(),
383-
ee.getLocalizedMessage(), error=ee)
384-
self._logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
385-
raise ex
386-
else:
387-
if data_type in ALIAS_LIST_TYPES or data_type in ALIAS_MAP_TYPES:
388-
merge = True
389-
if MERGE in attribute_info:
390-
merge = alias_utils.convert_boolean(attribute_info[MERGE])
391-
392-
if merge and data_type in ALIAS_MAP_TYPES:
393-
model_val = TypeUtils.convertToType(PROPERTIES, model_attribute_value)
394-
existing_val = TypeUtils.convertToType(PROPERTIES, existing_wlst_value)
395-
merged_value = alias_utils.merge_model_and_existing_properties(model_val, existing_val)
396-
elif merge and alias_utils.is_attribute_server_start_arguments(location, model_attribute_name):
397-
merged_value = alias_utils.merge_server_start_argument_values(model_attribute_value,
398-
existing_wlst_value)
399-
elif merge and existing_wlst_value is not None and len(existing_wlst_value) > 0:
400-
model_val = alias_utils.convert_to_type(LIST, model_attribute_value,
401-
delimiter=MODEL_LIST_DELIMITER)
402-
403-
_read_type, read_delimiter = \
404-
alias_utils.compute_read_data_type_and_delimiter_from_attribute_info(attribute_info,
405-
existing_wlst_value)
406-
existing_val = alias_utils.convert_to_type(LIST, existing_wlst_value,
407-
delimiter=read_delimiter)
408-
merged_value = alias_utils.merge_model_and_existing_lists(model_val, existing_val)
409-
else:
410-
merged_value = model_attribute_value
411-
412-
if data_type == JARRAY:
413-
subtype = 'java.lang.String'
414-
if SET_MBEAN_TYPE in attribute_info:
415-
subtype = attribute_info[SET_MBEAN_TYPE]
416-
wlst_attribute_value = alias_utils.convert_to_type(data_type, merged_value, subtype=subtype,
417-
delimiter=MODEL_LIST_DELIMITER)
418-
else:
419-
wlst_attribute_value = alias_utils.convert_to_type(data_type, merged_value,
420-
delimiter=MODEL_LIST_DELIMITER)
364+
if attribute_info and not self.__is_model_attribute_read_only(location, attribute_info):
365+
password_attribute_name = \
366+
password_utils.get_wlst_attribute_name(attribute_info, model_attribute_value, self._wlst_mode)
367+
368+
if password_attribute_name is not None:
369+
wlst_attribute_name = password_attribute_name
370+
else:
371+
wlst_attribute_name = attribute_info[WLST_NAME]
372+
373+
if self._model_context and USES_PATH_TOKENS in attribute_info\
374+
and string_utils.to_boolean(attribute_info[USES_PATH_TOKENS]):
375+
model_attribute_value = self._model_context.replace_token_string(model_attribute_value)
376+
377+
data_type = attribute_info[WLST_TYPE]
378+
if data_type == 'password':
379+
try:
380+
wlst_attribute_value = self.__decrypt_password(model_attribute_value)
381+
except EncryptionException, ee:
382+
ex = exception_helper.create_alias_exception('WLSDPLY-08402', model_attribute_name,
383+
location.get_folder_path(),
384+
ee.getLocalizedMessage(), error=ee)
385+
self._logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
386+
raise ex
387+
else:
388+
if data_type in ALIAS_LIST_TYPES or data_type in ALIAS_MAP_TYPES:
389+
merge = True
390+
if MERGE in attribute_info:
391+
merge = alias_utils.convert_boolean(attribute_info[MERGE])
392+
393+
if merge and data_type in ALIAS_MAP_TYPES:
394+
model_val = TypeUtils.convertToType(PROPERTIES, model_attribute_value)
395+
existing_val = TypeUtils.convertToType(PROPERTIES, existing_wlst_value)
396+
merged_value = alias_utils.merge_model_and_existing_properties(model_val, existing_val)
397+
elif merge and alias_utils.is_attribute_server_start_arguments(location, model_attribute_name):
398+
merged_value = alias_utils.merge_server_start_argument_values(model_attribute_value,
399+
existing_wlst_value)
400+
elif merge and existing_wlst_value is not None and len(existing_wlst_value) > 0:
401+
model_val = alias_utils.convert_to_type(LIST, model_attribute_value,
402+
delimiter=MODEL_LIST_DELIMITER)
403+
404+
_read_type, read_delimiter = \
405+
alias_utils.compute_read_data_type_and_delimiter_from_attribute_info(attribute_info,
406+
existing_wlst_value)
407+
existing_val = alias_utils.convert_to_type(LIST, existing_wlst_value,
408+
delimiter=read_delimiter)
409+
merged_value = alias_utils.merge_model_and_existing_lists(model_val, existing_val)
421410
else:
422-
wlst_attribute_value = alias_utils.convert_to_type(data_type, model_attribute_value,
411+
merged_value = model_attribute_value
412+
413+
if data_type == JARRAY:
414+
subtype = 'java.lang.String'
415+
if SET_MBEAN_TYPE in attribute_info:
416+
subtype = attribute_info[SET_MBEAN_TYPE]
417+
wlst_attribute_value = alias_utils.convert_to_type(data_type, merged_value, subtype=subtype,
423418
delimiter=MODEL_LIST_DELIMITER)
419+
else:
420+
wlst_attribute_value = alias_utils.convert_to_type(data_type, merged_value,
421+
delimiter=MODEL_LIST_DELIMITER)
422+
else:
423+
wlst_attribute_value = alias_utils.convert_to_type(data_type, model_attribute_value,
424+
delimiter=MODEL_LIST_DELIMITER)
424425

425426
return wlst_attribute_name, wlst_attribute_value
426427

0 commit comments

Comments
 (0)