Skip to content

Commit 40e961f

Browse files
committed
Issue #343 Clear targeting of JDBC resources after clusters are created
1 parent 9378974 commit 40e961f

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

core/src/main/python/wlsdeploy/tool/create/domain_creator.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,9 @@ def __create_clusters_and_servers(self, location):
750750
if len(server_nodes) > 0:
751751
self._create_named_mbeans(SERVER, server_nodes, location, log_created=True)
752752

753+
# targets may have been inadvertently assigned when clusters were added
754+
self.topology_helper.clear_jdbc_placeholder_targeting(resources_dict)
755+
753756
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
754757
return
755758

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,32 @@ def _update_placeholder(self, type_name, name, location):
148148
self.wlst_helper.set('Name', name)
149149
self.wlst_helper.cd(original_location)
150150

151+
def clear_jdbc_placeholder_targeting(self, resources):
152+
"""
153+
Remove any targets for the JDBC resources in the specified dictionary.
154+
Targets may have been inadvertently assigned when clusters were added after JDBC placeholders.
155+
:param resources: dictionary containing the resources section of the model
156+
"""
157+
_method_name = 'clear_jdbc_placeholder_targeting'
158+
resource_location = LocationContext().append_location(JDBC_SYSTEM_RESOURCE)
159+
token = self.alias_helper.get_name_token(resource_location)
160+
161+
if self.alias_helper.get_wlst_mbean_type(resource_location) is not None:
162+
name_nodes = dictionary_utils.get_dictionary_element(resources, JDBC_SYSTEM_RESOURCE)
163+
for name in name_nodes.keys():
164+
if model_helper.is_delete_name(name):
165+
# don't clear placeholder for delete names
166+
continue
167+
168+
self.logger.info('WLSDPLY-19404', JDBC_SYSTEM_RESOURCE, name, class_name=self.__class_name,
169+
method_name=_method_name)
170+
171+
resource_location.add_name_token(token, name)
172+
wlst_path = self.alias_helper.get_wlst_attributes_path(resource_location)
173+
if self.wlst_helper.path_exists(wlst_path):
174+
mbean = self.wlst_helper.get_mbean_for_wlst_path(wlst_path)
175+
mbean.setTargets(None)
176+
151177
def qualify_nm_properties(self, type_name, model_nodes, base_location, model_context, attribute_setter):
152178
"""
153179
For the NM properties MBean, update the keystore file path to be fully qualified with the domain directory.

core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,6 +1343,7 @@ WLSDPLY-19400=Creating placeholder for server template {0}
13431343
WLSDPLY-19401=Creating placeholder for JDBC resource {0}
13441344
WLSDPLY-19402=Creating placeholder for Server resource {0}
13451345
WLSDPLY-19403=Creating placeholder for {0} {1}
1346+
WLSDPLY-19404=Clearing targets for {0} placeholder {1}
13461347

13471348
# wlsdeploy/tool/util/variable_injector.py
13481349
WLSDPLY-19500=Model variable injector values loaded from location {0}

0 commit comments

Comments
 (0)