|
1 | 1 | """
|
2 |
| -Copyright (c) 2017, 2020, Oracle Corporation and/or its affiliates. |
| 2 | +Copyright (c) 2017, 2021, Oracle and/or its affiliates. |
3 | 3 | Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
|
4 | 4 | """
|
5 | 5 |
|
|
13 | 13 | from wlsdeploy.aliases.model_constants import CUSTOM_IDENTITY_KEYSTORE_FILE
|
14 | 14 | from wlsdeploy.aliases.model_constants import JDBC_RESOURCE
|
15 | 15 | from wlsdeploy.aliases.model_constants import JDBC_SYSTEM_RESOURCE
|
| 16 | +from wlsdeploy.aliases.model_constants import MIGRATABLE_TARGET |
16 | 17 | from wlsdeploy.aliases.model_constants import NM_PROPERTIES
|
17 | 18 | from wlsdeploy.aliases.model_constants import SERVER
|
18 | 19 | from wlsdeploy.aliases.model_constants import SERVER_TEMPLATE
|
@@ -173,6 +174,27 @@ def clear_jdbc_placeholder_targeting(self, jdbc_names):
|
173 | 174 | mbean = self.wlst_helper.get_mbean_for_wlst_path(wlst_path)
|
174 | 175 | mbean.setTargets(None)
|
175 | 176 |
|
| 177 | + def remove_deleted_clusters_and_servers(self, domain_location, model_topology): |
| 178 | + """ |
| 179 | + Remove clusters, servers, server templates, and migratable targets that were flagged for deletion |
| 180 | + in the model. The deletions are intentionally skipped when these elements are first created. |
| 181 | + :param domain_location: the location for the root of the domain |
| 182 | + :param model_topology: the topology folder from the model |
| 183 | + """ |
| 184 | + _method_name = 'remove_deleted_clusters_and_servers' |
| 185 | + self.logger.entering(str(domain_location), class_name=self.__class_name, method_name=_method_name) |
| 186 | + |
| 187 | + for folder_name in [CLUSTER, SERVER_TEMPLATE, SERVER, MIGRATABLE_TARGET]: |
| 188 | + location = LocationContext(domain_location).append_location(folder_name) |
| 189 | + existing_names = deployer_utils.get_existing_object_list(location, self.aliases) |
| 190 | + folder_nodes = dictionary_utils.get_dictionary_element(model_topology, folder_name) |
| 191 | + |
| 192 | + for mbean_name in folder_nodes: |
| 193 | + if model_helper.is_delete_name(mbean_name): |
| 194 | + deployer_utils.delete_named_element(location, mbean_name, existing_names, self.aliases) |
| 195 | + |
| 196 | + self.logger.exiting(class_name=self.__class_name, method_name=_method_name) |
| 197 | + |
176 | 198 | def qualify_nm_properties(self, type_name, model_nodes, base_location, model_context, attribute_setter):
|
177 | 199 | """
|
178 | 200 | For the NM properties MBean, update the keystore file path to be fully qualified with the domain directory.
|
|
0 commit comments