Skip to content

Commit a61a726

Browse files
committed
Merge branch 'issue-1663-delete-now' into 'main'
Apply the delete_now flag to subfolders consistently See merge request weblogic-cloud/weblogic-deploy-tooling!1835
2 parents 5b551c7 + 957d483 commit a61a726

File tree

6 files changed

+35
-30
lines changed

6 files changed

+35
-30
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,22 @@ def __init__(self, model, model_context, aliases, wlst_mode=WlstModes.OFFLINE):
5151
self._resources = self.model.get_model_resources()
5252

5353
# Override
54-
def _add_subfolders(self, model_nodes, location, excludes=None):
54+
def _add_subfolders(self, model_nodes, location, excludes=None, delete_now=True):
5555
"""
5656
Override the base method for sub-folders of self-tuning.
5757
The work manager sub-folder must be processed last.
5858
"""
5959
parent_type = self.get_location_type(location)
6060
if parent_type == SELF_TUNING:
6161
# add all sub-folders except work manager
62-
Deployer._add_subfolders(self, model_nodes, location, excludes=[WORK_MANAGER])
62+
Deployer._add_subfolders(self, model_nodes, location, excludes=[WORK_MANAGER], delete_now=delete_now)
6363

6464
# add the work manager sub-folder last
6565
watch_nodes = dictionary_utils.get_dictionary_element(model_nodes, WORK_MANAGER)
66-
self._add_named_elements(WORK_MANAGER, watch_nodes, location)
66+
self._add_named_elements(WORK_MANAGER, watch_nodes, location, delete_now=delete_now)
6767
return
6868

69-
Deployer._add_subfolders(self, model_nodes, location, excludes=excludes)
69+
Deployer._add_subfolders(self, model_nodes, location, excludes=excludes, delete_now=delete_now)
7070

7171
# Override
7272
def _create_and_cd(self, location, existing_names, child_nodes):

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2024, Oracle and/or its affiliates.
2+
Copyright (c) 2017, 2025, 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 array import array
@@ -117,20 +117,21 @@ def _add_named_elements(self, type_name, model_nodes, location, delete_now=True)
117117

118118
child_nodes = dictionary_utils.get_dictionary_element(model_nodes, name)
119119
self._create_and_cd(location, existing_names, child_nodes)
120-
self._set_attributes_and_add_subfolders(location, child_nodes)
120+
self._set_attributes_and_add_subfolders(location, child_nodes, delete_now=delete_now)
121121

122122
#
123123
# This method exists purely to allow subclasses to override how an mbean is created.
124124
#
125125
def _create_and_cd(self, location, existing_names, child_nodes):
126126
deployer_utils.create_and_cd(location, existing_names, self.aliases)
127127

128-
def _add_subfolders(self, model_nodes, location, excludes=None):
128+
def _add_subfolders(self, model_nodes, location, excludes=None, delete_now=True):
129129
"""
130130
Add each model sub-folder from the specified nodes and set its attributes.
131131
:param model_nodes: the child nodes of a model element
132132
:param location: the location where sub-folders should be added
133133
:param excludes: optional list of sub-folder names to be excluded from processing
134+
:param delete_now: Flag to determine if deletes are processed immediately or delayed
134135
"""
135136
location = LocationContext(location)
136137
model_subfolder_names = self.aliases.get_model_subfolder_names(location)
@@ -142,16 +143,17 @@ def _add_subfolders(self, model_nodes, location, excludes=None):
142143
if len(subfolder_nodes) != 0:
143144
sub_location = LocationContext(location).append_location(subfolder)
144145
if self.aliases.supports_multiple_mbean_instances(sub_location):
145-
self._add_named_elements(subfolder, subfolder_nodes, location)
146+
self._add_named_elements(subfolder, subfolder_nodes, location, delete_now=delete_now)
146147
else:
147-
self._add_model_elements(subfolder, subfolder_nodes, location)
148+
self._add_model_elements(subfolder, subfolder_nodes, location, delete_now=delete_now)
148149

149-
def _add_model_elements(self, type_name, model_nodes, location):
150+
def _add_model_elements(self, type_name, model_nodes, location, delete_now=True):
150151
"""
151152
Add each model element from the specified nodes at the specified location and set its attributes.
153+
:param type_name: the name of the model folder to add
152154
:param model_nodes: the child nodes of a model element
153155
:param location: the location where sub-folders should be added
154-
:param type_name: the name of the model folder to add
156+
:param delete_now: Flag to determine if deletes are processed immediately or delayed
155157
"""
156158
_method_name = '_add_model_elements'
157159

@@ -169,18 +171,19 @@ def _add_model_elements(self, type_name, model_nodes, location):
169171

170172
deployer_utils.create_and_cd(location, existing_subfolder_names, self.aliases)
171173

172-
self._set_attributes_and_add_subfolders(location, model_nodes)
174+
self._set_attributes_and_add_subfolders(location, model_nodes, delete_now=delete_now)
173175

174-
def _set_attributes_and_add_subfolders(self, location, model_nodes):
176+
def _set_attributes_and_add_subfolders(self, location, model_nodes, delete_now=True):
175177
"""
176178
Set the attributes and add sub-folders for the specified location.
177179
This method can be overridden for finer control of the ordering
178180
:param location: the location of the attributes and sub-folders
179181
:param model_nodes: a map of model nodes including attributes and sub-folders
182+
:param delete_now: Flag to determine if deletes are processed immediately or delayed
180183
:raise: DeployException: if an error condition is encountered
181184
"""
182185
self.set_attributes(location, model_nodes)
183-
self._add_subfolders(model_nodes, location)
186+
self._add_subfolders(model_nodes, location, delete_now=delete_now)
184187

185188
def set_attributes(self, location, model_nodes, excludes=None):
186189
"""

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def _add_named_elements(self, type_name, model_nodes, location, delete_now=True)
9696
Deployer._add_named_elements(self, type_name, model_nodes, location, delete_now)
9797

9898
# Override
99-
def _add_model_elements(self, type_name, model_nodes, location):
99+
def _add_model_elements(self, type_name, model_nodes, location, delete_now=True):
100100
"""
101101
Override the base method for these special cases:
102102
1) JMS resources must be deployed in specific order.
@@ -106,7 +106,7 @@ def _add_model_elements(self, type_name, model_nodes, location):
106106
self._add_jms_resources(model_nodes, location)
107107
return
108108

109-
Deployer._add_model_elements(self, type_name, model_nodes, location)
109+
Deployer._add_model_elements(self, type_name, model_nodes, location, delete_now=delete_now)
110110

111111
def _add_jms_resources(self, resource_nodes, location):
112112
"""

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,39 +44,41 @@ def add_multi_tenant_objects(self, location):
4444
self._add_partitions(location)
4545

4646
# Override
47-
def _add_subfolders(self, model_nodes, location, excludes=None):
47+
def _add_subfolders(self, model_nodes, location, excludes=None, delete_now=True):
4848
"""
4949
Override the base method for sub-folders of resource group and template.
5050
Those sub-folders must be processed in a specific order, some with special processing.
5151
:param model_nodes: the child nodes of a model element
5252
:param location: the location where sub-folders should be added
5353
:param excludes: optional list of sub-folder names to be excluded from processing
54+
:param delete_now: Flag to determine if deletes are processed immediately or delayed
5455
"""
5556
parent_type = self.get_location_type(location)
5657
is_in = (parent_type == RESOURCE_GROUP) or (parent_type == RESOURCE_GROUP_TEMPLATE)
5758
if is_in:
5859
self._add_resource_group_resources(model_nodes, location)
5960
return
6061

61-
Deployer._add_subfolders(self, model_nodes, location, excludes=excludes)
62+
Deployer._add_subfolders(self, model_nodes, location, excludes=excludes, delete_now=delete_now)
6263

6364
# Override
64-
def _set_attributes_and_add_subfolders(self, location, model_nodes):
65+
def _set_attributes_and_add_subfolders(self, location, model_nodes, delete_now=True):
6566
"""
6667
Override the base method for attributes and sub-folders of partition.
6768
Process sub-folders first to allow attributes to reference partition work manager and resource manager.
6869
:param location: the location of the attributes and sub-folders
6970
:param model_nodes: a map of model nodes including attributes and sub-folders
71+
:param delete_now: Flag to determine if deletes are processed immediately or delayed
7072
:raise: DeployException: if an error condition is encountered
7173
"""
7274
parent_type = self.get_location_type(location)
7375
if parent_type == PARTITION:
74-
self._add_subfolders(model_nodes, location)
76+
self._add_subfolders(model_nodes, location, delete_now=delete_now)
7577
self.wlst_helper.cd(self.aliases.get_wlst_attributes_path(location))
7678
self.set_attributes(location, model_nodes)
7779
return
7880

79-
Deployer._set_attributes_and_add_subfolders(self, location, model_nodes)
81+
Deployer._set_attributes_and_add_subfolders(self, location, model_nodes, delete_now=delete_now)
8082

8183
def _add_partitions(self, location):
8284
partitions = dictionary_utils.get_dictionary_element(self._resources, PARTITION)

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ def _add_named_elements(self, type_name, model_nodes, location, delete_now=True)
7575
self._topology_helper.check_coherence_cluster_references(type_name, model_nodes)
7676
# continue with regular processing
7777

78-
Deployer._add_named_elements(self, type_name, model_nodes, location, delete_now)
78+
Deployer._add_named_elements(self, type_name, model_nodes, location, delete_now=delete_now)
7979

8080
# Override
81-
def _add_model_elements(self, type_name, model_nodes, location):
82-
Deployer._add_model_elements(self, type_name, model_nodes, location)
81+
def _add_model_elements(self, type_name, model_nodes, location, delete_now=True):
82+
Deployer._add_model_elements(self, type_name, model_nodes, location, delete_now=delete_now)
8383

8484
# check for file paths that need to be qualified
8585
self._topology_helper.qualify_nm_properties(type_name, model_nodes, location, self.model_context,
@@ -237,9 +237,9 @@ def _process_section(self, folder_dict, folder_list, key, location, delete_now=T
237237
nodes = dictionary_utils.get_dictionary_element(folder_dict, key)
238238
sub_location = LocationContext(location).append_location(key)
239239
if self.aliases.supports_multiple_mbean_instances(sub_location):
240-
self._add_named_elements(key, nodes, location, delete_now)
240+
self._add_named_elements(key, nodes, location, delete_now=delete_now)
241241
else:
242-
self._add_model_elements(key, nodes, location)
242+
self._add_model_elements(key, nodes, location, delete_now=delete_now)
243243

244244
if key in folder_list:
245245
folder_list.remove(key)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ def add_wldf_modules(self, parent_dict, location):
3030
self._add_named_elements(WLDF_SYSTEM_RESOURCE, wldf_resources, location)
3131

3232
# Override
33-
def _add_subfolders(self, model_nodes, location, excludes=None):
33+
def _add_subfolders(self, model_nodes, location, excludes=None, delete_now=True):
3434
"""
3535
Override the base method for sub-folders of watch notification.
3636
The watch sub-folder must be processed last.
3737
"""
3838
parent_type = self.get_location_type(location)
3939
if parent_type == WATCH_NOTIFICATION:
4040
# add all sub-folders except watch
41-
Deployer._add_subfolders(self, model_nodes, location, excludes=[WATCH])
41+
Deployer._add_subfolders(self, model_nodes, location, excludes=[WATCH], delete_now=delete_now)
4242

4343
# add the watch sub-folder last
4444
watch_nodes = dictionary_utils.get_dictionary_element(model_nodes, WATCH)
45-
self._add_named_elements(WATCH, watch_nodes, location)
45+
self._add_named_elements(WATCH, watch_nodes, location, delete_now=delete_now)
4646
return
4747

48-
Deployer._add_subfolders(self, model_nodes, location, excludes=excludes)
48+
Deployer._add_subfolders(self, model_nodes, location, excludes=excludes, delete_now=delete_now)
4949
return

0 commit comments

Comments
 (0)