Skip to content

Commit c27612b

Browse files
committed
Merge branch 'jira-wdt-971' into 'main'
Fix attributes that are comma-separated strings in WLST, lists in model See merge request weblogic-cloud/weblogic-deploy-tooling!1848
2 parents c4ab27a + dc1f226 commit c27612b

File tree

5 files changed

+62
-32
lines changed

5 files changed

+62
-32
lines changed

core/src/main/python/wlsdeploy/tool/util/attribute_setter.py

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,18 @@ def set_machine_mbean(self, location, key, value, wlst_value):
398398
mbean = self.__find_in_location(LocationContext(), MACHINE, value, required=True)
399399
self.set_attribute(location, key, mbean, wlst_merge_value=wlst_value, use_raw_value=True)
400400

401+
def set_machine_mbeans(self, location, key, value, wlst_value):
402+
"""
403+
Set a list of Machine MBeans.
404+
:param location: the location
405+
:param key: the attribute name
406+
:param value: the string value
407+
:param wlst_value: the existing value of the attribute from WLST
408+
:raises BundleAwareException of the specified type: if machine is not found
409+
"""
410+
mbeans = self.__build_machine_mbean_list(value, wlst_value, location, key)
411+
self.set_attribute(location, key, mbeans, wlst_merge_value=wlst_value, use_raw_value=True)
412+
401413
def set_jms_template_mbean(self, location, key, value, wlst_value):
402414
"""
403415
Set the JMS Template MBean.
@@ -873,14 +885,7 @@ def __build_server_mbean_list(self, value, wlst_value, location, key):
873885
:return: the Java array of MBeans ObjectNames
874886
:raises BundleAwareException of the specified type: if an error occurs
875887
"""
876-
server_names = self.__merge_existing_items(value, wlst_value, location, key)
877-
878-
name_list = []
879-
for server_name in server_names:
880-
mbean = self.__find_in_location(LocationContext(), SERVER, server_name, required=True)
881-
name_list.append(mbean.getObjectName())
882-
883-
return jarray.array(name_list, ObjectName)
888+
return self.__build_mbean_list(SERVER, value, wlst_value, location, key)
884889

885890
def __build_virtual_target_mbean_list(self, target_value, wlst_value, location, key):
886891
"""
@@ -892,19 +897,44 @@ def __build_virtual_target_mbean_list(self, target_value, wlst_value, location,
892897
:return: for offline, a list of MBeans; for online, a jarray of MBean ObjectNames
893898
:raises BundleAwareException of the specified type: if an error occurs
894899
"""
895-
target_names = self.__merge_existing_items(target_value, wlst_value, location, key)
900+
return self.__build_mbean_list(VIRTUAL_TARGET, target_value, wlst_value, location, key)
901+
902+
def __build_machine_mbean_list(self, value, wlst_value, location, key):
903+
"""
904+
Construct the machine MBean list.
905+
:param value: the value
906+
:param wlst_value: the existing value from WLST
907+
:param location: location of the attribute
908+
:param key: the attribute name
909+
:return: the Java array of MBeans ObjectNames
910+
:raises BundleAwareException of the specified type: if an error occurs
911+
"""
912+
return self.__build_mbean_list(MACHINE, value, wlst_value, location, key)
913+
914+
def __build_mbean_list(self, folder_name, value, wlst_value, location, key):
915+
"""
916+
Construct the MBean list using the specified model folder.
917+
:param folder_name: the model folder to search, such as MACHINE or SERVER
918+
:param value: the value
919+
:param wlst_value: the existing value from WLST
920+
:param location: location of the attribute
921+
:param key: the attribute name
922+
:return: the Java array of MBeans ObjectNames
923+
:raises BundleAwareException of the specified type: if an error occurs
924+
"""
925+
mbean_names = self.__merge_existing_items(value, wlst_value, location, key)
896926

897927
if self.__wlst_mode == WlstModes.ONLINE:
898928
name_list = []
899-
for target_name in target_names:
900-
target_mbean = self.__find_in_location(LocationContext(), VIRTUAL_TARGET, target_name, required=True)
901-
name_list.append(target_mbean.getObjectName())
929+
for mbean_name in mbean_names:
930+
mbean = self.__find_in_location(LocationContext(), folder_name, mbean_name, required=True)
931+
name_list.append(mbean.getObjectName())
902932
return jarray.array(name_list, ObjectName)
903933
else:
904934
mbean_list = []
905-
for target_name in target_names:
906-
target_mbean = self.__find_in_location(LocationContext(), VIRTUAL_TARGET, target_name, required=True)
907-
mbean_list.append(target_mbean)
935+
for mbean_name in mbean_names:
936+
mbean = self.__find_in_location(LocationContext(), folder_name, mbean_name, required=True)
937+
mbean_list.append(mbean)
908938
return mbean_list
909939

910940
def __find_target(self, target_name, location, include_jms=False):

0 commit comments

Comments
 (0)