Skip to content

Commit 112c71a

Browse files
authored
Avoid re-deploying clusters and servers a second time (#820)
* Update type match to use qualified class name for new Jython version * Issue #819 - Remove deleted clusters and servers, rather than redeploying all of them
1 parent 231c0be commit 112c71a

File tree

4 files changed

+32
-11
lines changed

4 files changed

+32
-11
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2020, Oracle Corporation and/or its affiliates.
2+
Copyright (c) 2017, 2021, Oracle and/or its affiliates.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
"""
55
import os
@@ -50,12 +50,8 @@
5050
from wlsdeploy.aliases.model_constants import PASSWORD
5151
from wlsdeploy.aliases.model_constants import PASSWORD_ENCRYPTED
5252
from wlsdeploy.aliases.model_constants import PRODUCTION_MODE_ENABLED
53-
from wlsdeploy.aliases.model_constants import RCU_ADMIN_PASSWORD
5453
from wlsdeploy.aliases.model_constants import RCU_COMP_INFO
55-
from wlsdeploy.aliases.model_constants import RCU_DB_CONN
5654
from wlsdeploy.aliases.model_constants import RCU_DB_INFO
57-
from wlsdeploy.aliases.model_constants import RCU_PREFIX
58-
from wlsdeploy.aliases.model_constants import RCU_SCHEMA_PASSWORD
5955
from wlsdeploy.aliases.model_constants import RCU_STG_INFO
6056
from wlsdeploy.aliases.model_constants import RESOURCE_GROUP
6157
from wlsdeploy.aliases.model_constants import RESOURCE_GROUP_TEMPLATE
@@ -626,7 +622,8 @@ def __apply_base_domain_config(self, topology_folder_list):
626622

627623
self.__create_mbeans_used_by_topology_mbeans(location, topology_folder_list)
628624

629-
self.__create_machines_clusters_and_servers()
625+
# these deletions were intentionally skipped when these elements are first created.
626+
self.topology_helper.remove_deleted_clusters_and_servers(location, self._topology)
630627
topology_folder_list.remove(MACHINE)
631628
topology_folder_list.remove(UNIX_MACHINE)
632629
topology_folder_list.remove(CLUSTER)

core/src/main/python/wlsdeploy/tool/deploy/topology_updater.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2020, Oracle Corporation and/or its affiliates.
2+
Copyright (c) 2017, 2021, Oracle and/or its affiliates.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
"""
55
from wlsdeploy.aliases.location_context import LocationContext
@@ -97,7 +97,8 @@ def update(self):
9797
self._process_section(self._topology, folder_list, ADMIN_CONSOLE, location)
9898
self._process_section(self._topology, folder_list, CDI_CONTAINER, location)
9999

100-
self.update_machines_clusters_and_servers()
100+
# these deletions were intentionally skipped when these elements are first created.
101+
self._topology_helper.remove_deleted_clusters_and_servers(location, self._topology)
101102
folder_list.remove(CLUSTER)
102103
folder_list.remove(SERVER)
103104
folder_list.remove(SERVER_TEMPLATE)

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2020, Oracle Corporation and/or its affiliates.
2+
Copyright (c) 2017, 2021, Oracle and/or its affiliates.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
"""
55

@@ -13,6 +13,7 @@
1313
from wlsdeploy.aliases.model_constants import CUSTOM_IDENTITY_KEYSTORE_FILE
1414
from wlsdeploy.aliases.model_constants import JDBC_RESOURCE
1515
from wlsdeploy.aliases.model_constants import JDBC_SYSTEM_RESOURCE
16+
from wlsdeploy.aliases.model_constants import MIGRATABLE_TARGET
1617
from wlsdeploy.aliases.model_constants import NM_PROPERTIES
1718
from wlsdeploy.aliases.model_constants import SERVER
1819
from wlsdeploy.aliases.model_constants import SERVER_TEMPLATE
@@ -173,6 +174,27 @@ def clear_jdbc_placeholder_targeting(self, jdbc_names):
173174
mbean = self.wlst_helper.get_mbean_for_wlst_path(wlst_path)
174175
mbean.setTargets(None)
175176

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+
176198
def qualify_nm_properties(self, type_name, model_nodes, base_location, model_context, attribute_setter):
177199
"""
178200
For the NM properties MBean, update the keystore file path to be fully qualified with the domain directory.

core/src/main/python/wlsdeploy/tool/validate/validation_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2020, Oracle Corporation and/or its affiliates. All rights reserved.
2+
Copyright (c) 2017, 2021, Oracle and/or its affiliates.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
"""
55
import re
@@ -126,7 +126,8 @@ def is_compatible_data_type(expected_data_type, actual_data_type):
126126
elif expected_data_type in ['float', 'double']:
127127
retval = (actual_data_type in ["<type 'float'>", "<type 'str'>", "<type 'unicode'>"])
128128
elif expected_data_type == 'properties' or expected_data_type == 'dict':
129-
retval = (actual_data_type in ["<type 'PyOrderedDict'>", "<type 'dict'>", "<type 'str'>"])
129+
retval = (actual_data_type in ["<type 'PyOrderedDict'>", "<type 'oracle.weblogic.deploy.util.PyOrderedDict'>",
130+
"<type 'dict'>", "<type 'str'>"])
130131
elif 'list' in expected_data_type:
131132
retval = (actual_data_type in ["<type 'list'>", "<type 'str'>", "<type 'unicode'>"])
132133
elif expected_data_type in ['password', 'credential', 'jarray']:

0 commit comments

Comments
 (0)