Skip to content

Avoid unintended assignment of datasources to admin #572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/src/main/python/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ def __update_online(model, model_context, aliases):
exit_code = 0

__update_online_domain(model_context)
__wlst_helper.edit()
__wlst_helper.start_edit()

topology_updater.set_server_groups()
__update_online_domain(model_context)
Expand Down
5 changes: 4 additions & 1 deletion core/src/main/python/wlsdeploy/tool/create/domain_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ def __create_clusters_and_servers(self, location):

# create placeholders for JDBC resources that may be referenced in cluster definition.
resources_dict = self.model.get_model_resources()
self.topology_helper.create_placeholder_jdbc_resources(resources_dict)
jdbc_names = self.topology_helper.create_placeholder_jdbc_resources(resources_dict)
cluster_nodes = dictionary_utils.get_dictionary_element(self._topology, CLUSTER)
if len(cluster_nodes) > 0:
self._create_named_mbeans(CLUSTER, cluster_nodes, location, log_created=True)
Expand All @@ -779,6 +779,9 @@ def __create_clusters_and_servers(self, location):
if len(server_nodes) > 0:
self._create_named_mbeans(SERVER, server_nodes, location, log_created=True)

# targets may have been inadvertently assigned when clusters were added
self.topology_helper.clear_jdbc_placeholder_targeting(jdbc_names)

self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def update(self):
self._topology_helper.create_placeholder_server_templates(self._topology)

# create placeholders for JDBC resources that may be referenced in cluster definition.
self._topology_helper.create_placeholder_jdbc_resources(self._resources)
jdbc_names = self._topology_helper.create_placeholder_jdbc_resources(self._resources)

self._process_section(self._topology, folder_list, CLUSTER, location)
self._process_section(self._topology, folder_list, SERVER_TEMPLATE, location)
Expand All @@ -113,6 +113,9 @@ def update(self):

self._process_section(self._topology, folder_list, SERVER, location)

# targets may have been inadvertently assigned when clusters were added
self.topology_helper.clear_jdbc_placeholder_targeting(jdbc_names)

self._process_section(self._topology, folder_list, MIGRATABLE_TARGET, location)

new_managed_server_list, new_configured_cluster_list = self._create_list_of_setservergroups_targets()
Expand Down
27 changes: 26 additions & 1 deletion core/src/main/python/wlsdeploy/tool/util/topology_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ def create_placeholder_jdbc_resources(self, resources):
Create a placeholder JDBC resource for each name in the resources section.
This is necessary because cluster attributes may reference JDBC resources.
:param resources: the resource model nodes
:return: a list of names of created placeholders
"""
self.create_placeholder_named_elements(LocationContext(), JDBC_SYSTEM_RESOURCE, resources)
return self.create_placeholder_named_elements(LocationContext(), JDBC_SYSTEM_RESOURCE, resources)

def create_placeholder_named_elements(self, location, model_type, model_nodes):
"""
Expand All @@ -103,8 +104,10 @@ def create_placeholder_named_elements(self, location, model_type, model_nodes):
:param location: the location for the nodes to be added
:param model_type: the type of the specified model nodes
:param model_nodes: the model nodes
:return: a list of names of created placeholders
"""
_method_name = 'create_placeholder_named_elements'
holder_names = []
original_location = self.wlst_helper.get_pwd()
resource_location = LocationContext(location).append_location(model_type)

Expand All @@ -125,8 +128,10 @@ def create_placeholder_named_elements(self, location, model_type, model_nodes):
resource_location.add_name_token(token, name)
deployer_utils.create_and_cd(resource_location, existing_names, self.alias_helper)
self._update_placeholder(model_type, name, resource_location)
holder_names.append(name)

self.wlst_helper.cd(original_location)
return holder_names

def _update_placeholder(self, type_name, name, location):
"""
Expand All @@ -148,6 +153,26 @@ def _update_placeholder(self, type_name, name, location):
self.wlst_helper.set('Name', name)
self.wlst_helper.cd(original_location)

def clear_jdbc_placeholder_targeting(self, jdbc_names):
"""
Remove any targets for the JDBC resources in the specified list of names.
Targets may have been inadvertently assigned when clusters were added after JDBC placeholders.
:param jdbc_names: names of placeholders to clear
"""
_method_name = 'clear_jdbc_placeholder_targeting'
resource_location = LocationContext().append_location(JDBC_SYSTEM_RESOURCE)
token = self.alias_helper.get_name_token(resource_location)

for name in jdbc_names:
self.logger.info('WLSDPLY-19404', JDBC_SYSTEM_RESOURCE, name, class_name=self.__class_name,
method_name=_method_name)

resource_location.add_name_token(token, name)
wlst_path = self.alias_helper.get_wlst_attributes_path(resource_location)
if self.wlst_helper.path_exists(wlst_path):
mbean = self.wlst_helper.get_mbean_for_wlst_path(wlst_path)
mbean.setTargets(None)

def qualify_nm_properties(self, type_name, model_nodes, base_location, model_context, attribute_setter):
"""
For the NM properties MBean, update the keystore file path to be fully qualified with the domain directory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
"LogFileSeverity": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "LogFileSeverity", "wlst_path": "WP001", "value": {"default": "Trace" }, "wlst_type": "string" } ],
"LogMonitoringEnabled": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "LogMonitoringEnabled", "wlst_path": "WP001", "value": {"default": "true" }, "wlst_type": "boolean"} ],
"LogMonitoringIntervalSecs": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "LogMonitoringIntervalSecs", "wlst_path": "WP001", "value": {"default": 30 }, "wlst_type": "integer"} ],
"LogMonitoringMaxThrottleMessageSignatureCount": [ {"version": "[12.2.1.1,)", "wlst_mode": "online", "wlst_name": "LogMonitoringMaxThrottleMessageSignatureCount", "wlst_path": "WP001", "value": {"default": 1000 }, "wlst_type": "integer"} ,
"LogMonitoringMaxThrottleMessageSignatureCount": [ {"version": "[12.2.1.1,12.2.1.3)", "wlst_mode": "online", "wlst_name": "LogMonitoringMaxThrottleMessageSignatureCount", "wlst_path": "WP001", "value": {"default": 1000 }, "wlst_type": "integer"} ,
{"version": "[12.2.1.3,)", "wlst_mode": "both", "wlst_name": "LogMonitoringMaxThrottleMessageSignatureCount", "wlst_path": "WP001", "value": {"default": 1000 }, "wlst_type": "integer"} ],
"LogMonitoringThrottleMessageLength": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "LogMonitoringThrottleMessageLength", "wlst_path": "WP001", "value": {"default": 50 }, "wlst_type": "integer"} ],
"LogMonitoringThrottleThreshold": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "LogMonitoringThrottleThreshold", "wlst_path": "WP001", "value": {"default": 1500 }, "wlst_type": "integer"} ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,7 @@ WLSDPLY-19400=Creating placeholder for server template {0}
WLSDPLY-19401=Creating placeholder for JDBC resource {0}
WLSDPLY-19402=Creating placeholder for Server resource {0}
WLSDPLY-19403=Creating placeholder for {0} {1}
WLSDPLY-19404=Clearing targets for {0} placeholder {1}

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