|
43 | 43 | from wlsdeploy.aliases.alias_constants import RESTART_REQUIRED |
44 | 44 | from wlsdeploy.aliases.alias_constants import SET_MBEAN_TYPE |
45 | 45 | from wlsdeploy.aliases.alias_constants import SET_METHOD |
| 46 | +from wlsdeploy.aliases.alias_constants import STRING |
46 | 47 | from wlsdeploy.aliases.alias_constants import USES_PATH_TOKENS |
47 | 48 | from wlsdeploy.aliases.alias_constants import VALUE |
48 | 49 | from wlsdeploy.aliases.alias_constants import WLST_NAME |
@@ -969,13 +970,18 @@ def get_model_attribute_name_and_value(self, location, wlst_attribute_name, wlst |
969 | 970 | if default_value == '[]' or default_value == 'None': |
970 | 971 | model_attribute_value = None |
971 | 972 |
|
| 973 | + elif self._model_context is not None and USES_PATH_TOKENS in attribute_info: |
| 974 | + if attribute_info[WLST_TYPE] == STRING: |
| 975 | + model_attribute_value = self._model_context.tokenize_path(converted_value) |
| 976 | + else: |
| 977 | + model_attribute_value = self._model_context.tokenize_classpath(converted_value) |
| 978 | + if model_attribute_value == default_value: |
| 979 | + model_attribute_value = None |
972 | 980 | elif str(converted_value) != str(default_value): |
973 | 981 | if _strings_are_empty(converted_value, default_value): |
974 | 982 | model_attribute_value = None |
975 | 983 | else: |
976 | 984 | model_attribute_value = converted_value |
977 | | - if self._model_context and USES_PATH_TOKENS in attribute_info: |
978 | | - model_attribute_value = self._model_context.tokenize_path(model_attribute_value) |
979 | 985 |
|
980 | 986 | self._logger.exiting(class_name=self._class_name, method_name=_method_name, |
981 | 987 | result={model_attribute_name: model_attribute_value}) |
@@ -1245,22 +1251,23 @@ def __is_model_attribute_read_only(self, location, attribute_info): |
1245 | 1251 | return rtnval |
1246 | 1252 |
|
1247 | 1253 |
|
| 1254 | +def _convert_to_string(value): |
| 1255 | + if type(value) in [str, unicode]: |
| 1256 | + str_converted_value = value |
| 1257 | + else: |
| 1258 | + str_converted_value = str(value) |
| 1259 | + return str_converted_value |
| 1260 | + |
| 1261 | + |
1248 | 1262 | def _strings_are_empty(converted_value, default_value): |
1249 | 1263 | """ |
1250 | 1264 | Test converted and default values to see if they are both either None or an empty string |
1251 | 1265 | :param converted_value: the converted value |
1252 | 1266 | :param default_value: the default value |
1253 | 1267 | :return: |
1254 | 1268 | """ |
1255 | | - if type(converted_value) is str: |
1256 | | - str_converted_value = converted_value |
1257 | | - else: |
1258 | | - str_converted_value = str(converted_value) |
1259 | | - |
1260 | | - if type(default_value) is str: |
1261 | | - str_default_value = default_value |
1262 | | - else: |
1263 | | - str_default_value = str(default_value) |
| 1269 | + str_converted_value = _convert_to_string(converted_value) |
| 1270 | + str_default_value = _convert_to_string(default_value) |
1264 | 1271 |
|
1265 | 1272 | if str_default_value == 'None': |
1266 | 1273 | str_default_value = None |
|
0 commit comments