Skip to content

Commit 6cd5c77

Browse files
committed
Fixing config-root to always be an absolute path at the final resting place
1 parent 6ae577b commit 6cd5c77

File tree

29 files changed

+354
-193
lines changed

29 files changed

+354
-193
lines changed

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pipeline {
1010
}
1111
triggers {
1212
// timer trigger for "nightly build" on main branch
13-
cron( env.BRANCH_NAME.equals('main') ? 'H H(0-3) * * 1-5' : '')
13+
cron( env.BRANCH_NAME.equals('main') ? 'H H(2-3) * * 1-5' : '')
1414
}
1515
stages {
1616
stage ('Environment') {

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

Lines changed: 50 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -139,50 +139,65 @@ def _does_deployment_to_delete_exist(self, deployment_name, existing_deployment_
139139
self.logger.exiting(class_name=self._class_name, method_name=_method_name, result=found_deployment)
140140
return found_deployment
141141

142-
def _fixup_structured_app_plan_file_config_root(self, structured_app_dict):
142+
def _fixup_structured_app_plan_file_config_root(self, structured_app_name, structured_app_dict):
143143
_method_name = '_fixup_structured_app_plan_file_config_root'
144-
self.logger.entering(structured_app_dict, class_name=self._class_name, method_name=_method_name)
144+
self.logger.entering(structured_app_name, structured_app_dict,
145+
class_name=self._class_name, method_name=_method_name)
145146

146-
# The plan file must exist for structured applications...
147+
# The plan file must exist for structured applications but we should only edit
148+
# it if we plan to move it--which means only if it is in the archive...
147149
plan_file_name = self._get_combined_model_plan_path(structured_app_dict)
148-
# The config-root of the deployment plan must be set to the plan_dir.
149-
plan_dir, __ = self.path_helper.split(plan_file_name)
150-
plan_dir = plan_dir.replace('\\', '/')
151-
152-
if self.path_helper.is_relative_local_path(plan_file_name):
150+
if deployer_utils.is_path_into_archive(plan_file_name):
151+
# We need to know where the file lives on the local file system so that it can be edited.
153152
if self.model_context.is_remote() or self.model_context.is_ssh():
154153
plan_file_name = self.path_helper.local_join(self.upload_temporary_dir, plan_file_name)
155154
else:
156155
plan_file_name = self.path_helper.local_join(self.model_context.get_domain_home(), plan_file_name)
157156

158-
dbf = DocumentBuilderFactory.newInstance()
159-
db = dbf.newDocumentBuilder()
160-
document = db.parse(File(plan_file_name))
161-
document.normalizeDocument()
162-
elements = document.getElementsByTagName("config-root")
163-
164-
if elements is not None and elements.getLength() > 0:
165-
element = elements.item(0)
166-
element.setNodeValue(plan_dir)
167-
element.setTextContent(plan_dir)
168-
output_stream = None
169-
try:
170-
output_stream = FileOutputStream(plan_file_name)
171-
transformer_factory = TransformerFactory.newInstance()
172-
transformer = transformer_factory.newTransformer()
173-
transformer.setOutputProperty(OutputKeys.INDENT, "yes")
174-
transformer.setOutputProperty(OutputKeys.STANDALONE, "no")
175-
source = DOMSource(document)
176-
result = StreamResult(output_stream)
177-
178-
transformer.transform(source, result)
179-
finally:
180-
if output_stream is not None:
157+
# The config-root of the deployment plan must be set to the location where the plan_dir will eventually live.
158+
future_plan_file_name = self._get_combined_model_plan_path(structured_app_dict)
159+
future_plan_file_name = self.path_helper.join(self.model_context.get_domain_home(), future_plan_file_name)
160+
plan_dir, __ = self.path_helper.split(future_plan_file_name)
161+
# Since the plan is processed by Java code, go ahead and replace any Windows separators with forward slashes.
162+
plan_dir = plan_dir.replace('\\', '/')
163+
164+
if File(plan_file_name).isFile():
165+
dbf = DocumentBuilderFactory.newInstance()
166+
db = dbf.newDocumentBuilder()
167+
document = db.parse(File(plan_file_name))
168+
document.normalizeDocument()
169+
elements = document.getElementsByTagName("config-root")
170+
171+
if elements is not None and elements.getLength() > 0:
172+
element = elements.item(0)
173+
element.setNodeValue(plan_dir)
174+
element.setTextContent(plan_dir)
175+
output_stream = None
181176
try:
182-
output_stream.close()
183-
except IOException:
184-
# best effort only...
185-
pass
177+
output_stream = FileOutputStream(plan_file_name)
178+
transformer_factory = TransformerFactory.newInstance()
179+
transformer = transformer_factory.newTransformer()
180+
transformer.setOutputProperty(OutputKeys.INDENT, "yes")
181+
transformer.setOutputProperty(OutputKeys.STANDALONE, "no")
182+
source = DOMSource(document)
183+
result = StreamResult(output_stream)
184+
185+
transformer.transform(source, result)
186+
finally:
187+
if output_stream is not None:
188+
try:
189+
output_stream.close()
190+
except IOException:
191+
# best effort only...
192+
pass
193+
else:
194+
self.logger.warning('WLSDPLY-09352', structured_app_name, plan_file_name,
195+
class_name=self._class_name, method_name=_method_name)
196+
else:
197+
self.logger.fine('WLSDPLY-09353', structured_app_name, plan_file_name,
198+
class_name=self._class_name, method_name=_method_name)
199+
200+
self.logger.exiting(class_name=self._class_name, method_name=_method_name)
186201

187202
def _is_structured_app(self, app_name, app_dict):
188203
"""

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def __deploy_applications(self):
130130
self._substitute_appmodule_token(app_source_path, module_type)
131131
is_structured_app, __ = self._is_structured_app(application_name, application)
132132
if is_structured_app:
133-
self._fixup_structured_app_plan_file_config_root(application)
133+
self._fixup_structured_app_plan_file_config_root(application_name, application)
134134

135135
application_location.remove_name_token(application_token)
136136
else:

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

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ def __deploy_model_deployments(self, deployments, deployments_location, deployme
826826
if deployment_type == APPLICATION:
827827
is_structured_app, _ = self._is_structured_app(deployment_name, deployment_dict)
828828
if is_structured_app:
829-
self._fixup_structured_app_plan_file_config_root(deployment_dict)
829+
self._fixup_structured_app_plan_file_config_root(deployment_name, deployment_dict)
830830

831831
model_source_path = dictionary_utils.get_element(deployment_dict, SOURCE_PATH)
832832
source_path = self.__get_online_deployment_path(deployment_name, deployment_type, SOURCE_PATH, model_source_path)
@@ -872,6 +872,10 @@ def __deploy_app_or_library(self, application_name, model_source_path, deploy_so
872872
:param options: optional, extra options for the WLST deploy() call
873873
"""
874874
_method_name = '__deploy_app_or_library'
875+
self.logger.entering(application_name, model_source_path, deploy_source_path, targets, stage_mode, plan,
876+
partition, resource_group, resource_group_template, sub_module_targets, module_type,
877+
options, class_name=self._class_name, method_name=_method_name)
878+
875879
is_library = False
876880
if options is not None:
877881
is_library = dictionary_utils.get_element(options, 'libraryModule') == 'true'
@@ -941,6 +945,8 @@ def __deploy_app_or_library(self, application_name, model_source_path, deploy_so
941945
self.logger.fine('WLSDPLY-09320', type_name, application_name, kwargs,
942946
class_name=self._class_name, method_name=_method_name)
943947
self.wlst_helper.deploy_application(application_name, *args, **kwargs)
948+
949+
self.logger.exiting(class_name=self._class_name, method_name=_method_name, result=application_name)
944950
return application_name
945951

946952
def __get_deployment_ordering(self, apps):
@@ -1103,6 +1109,8 @@ def __set_sub_deployments_for_app_module(self, app, module_type, sub_module_targ
11031109
def __undeploy_app(self, application_name, library_module='false', partition_name=None,
11041110
resource_group_template=None, targets=None):
11051111
_method_name = '__undeploy_app'
1112+
self.logger.entering(application_name, library_module, partition_name, resource_group_template, targets,
1113+
class_name=self._class_name, method_name=_method_name)
11061114

11071115
type_name = APPLICATION
11081116
if library_module == 'true':
@@ -1120,6 +1128,8 @@ def __undeploy_app(self, application_name, library_module='false', partition_nam
11201128
timeout=self.model_context.get_model_config().get_undeploy_timeout(),
11211129
targets=targets)
11221130

1131+
self.logger.exiting(class_name=self._class_name, method_name=_method_name)
1132+
11231133
def __delete_deployment_on_server(self, deployment_name, deployment_dict):
11241134
"""
11251135
Remove deployed files on server after undeploy.
@@ -1132,6 +1142,8 @@ def __delete_deployment_on_server(self, deployment_name, deployment_dict):
11321142
# e.g. appDeployments:
11331143
# "!myear":
11341144
#
1145+
_method_name = '__delete_deployment_on_server'
1146+
self.logger.entering(deployment_name, deployment_dict, class_name=self._class_name, method_name=_method_name)
11351147

11361148
if deployment_dict is not None and SOURCE_PATH in deployment_dict:
11371149
source_path = deployment_dict[SOURCE_PATH]
@@ -1150,6 +1162,8 @@ def __delete_deployment_on_server(self, deployment_name, deployment_dict):
11501162
FileUtils.deleteDirectory(File(self.path_helper.local_join(
11511163
self.model_context.get_domain_home(), delete_path)))
11521164

1165+
self.logger.exiting(class_name=self._class_name, method_name=_method_name)
1166+
11531167
def _replace_deployments_path_tokens(self, deployment_type, deployments_dict):
11541168
_method_name = '_replace_deployments_path_tokens'
11551169
self.logger.entering(deployment_type, class_name=self._class_name, method_name=_method_name)
@@ -1189,10 +1203,10 @@ def __get_online_deployment_path(self, model_name, model_type, attribute_name, a
11891203

11901204
def __stop_app(self, application_name, partition_name=None):
11911205
_method_name = '__stop_app'
1206+
self.logger.entering(application_name, partition_name, class_name=self._class_name, method_name=_method_name)
11921207

11931208
self.logger.info('WLSDPLY-09312', application_name, class_name=self._class_name, method_name=_method_name)
1194-
progress = self.wlst_helper.stop_application(
1195-
application_name, partition=partition_name,
1209+
progress = self.wlst_helper.stop_application(application_name, partition=partition_name,
11961210
timeout=self.model_context.get_model_config().get_stop_app_timeout())
11971211
while progress.isRunning():
11981212
continue
@@ -1201,13 +1215,18 @@ def __stop_app(self, application_name, partition_name=None):
12011215
self.logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
12021216
raise ex
12031217

1218+
self.logger.exiting(class_name=self._class_name, method_name=_method_name)
1219+
12041220
def __start_app(self, application_name, partition_name=None):
12051221
_method_name = '__start_app'
1222+
self.logger.entering(application_name, partition_name, class_name=self._class_name, method_name=_method_name)
12061223

12071224
self.logger.info('WLSDPLY-09313', application_name, class_name=self._class_name, method_name=_method_name)
12081225
self.wlst_helper.start_application(application_name, partition=partition_name,
12091226
timeout=self.model_context.get_model_config().get_start_app_timeout())
12101227

1228+
self.logger.exiting(class_name=self._class_name, method_name=_method_name)
1229+
12111230
def __start_all_apps(self, deployed_app_list, base_location, is_restart_required=False):
12121231
_method_name = '__start_all_apps'
12131232
self.logger.entering(deployed_app_list, str_helper.to_string(base_location), is_restart_required,

core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/Cluster.json

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,11 @@
143143
"default_name_value": "${NO_NAME_0:%CLUSTER%}",
144144
"folders" : {},
145145
"attributes" : {
146-
"MaxStuckThreadTime": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "MaxStuckThreadTime", "wlst_path": "WP001", "default_value": 600, "wlst_type": "integer" } ],
147-
"StuckThreadCount": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "StuckThreadCount", "wlst_path": "WP001", "default_value": 0, "wlst_type": "integer", "get_method": "GET" } ],
148-
"Notes": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "default_value": null, "wlst_type": "string" } ]
146+
"HeapDumpingOnDeadlock": [ {"version": "[14.1.2,)", "wlst_mode": "online", "wlst_name": "HeapDumpingOnDeadlock", "wlst_path": "WP001", "default_value": false, "wlst_type": "boolean" } ],
147+
"HeapDumpingOnMaxStuckThread": [ {"version": "[14.1.2,)", "wlst_mode": "online", "wlst_name": "HeapDumpingOnMaxStuckThread", "wlst_path": "WP001", "default_value": false, "wlst_type": "boolean" } ],
148+
"MaxStuckThreadTime": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "MaxStuckThreadTime", "wlst_path": "WP001", "default_value": 600, "wlst_type": "integer" } ],
149+
"StuckThreadCount": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "StuckThreadCount", "wlst_path": "WP001", "default_value": 0, "wlst_type": "integer", "get_method": "GET" } ],
150+
"Notes": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "default_value": null, "wlst_type": "string" } ]
149151
},
150152
"wlst_attributes_path": "WP001",
151153
"wlst_paths": {
@@ -154,14 +156,14 @@
154156
}
155157
},
156158
"attributes" : {
157-
"FailureAction": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "FailureAction", "wlst_path": "WP001", "default_value": "${__NULL__:no-action}", "derived_default": "${:true}", "wlst_type": "string" } ],
158-
"FreeMemoryPercentHighThreshold": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "FreeMemoryPercentHighThreshold", "wlst_path": "WP001", "default_value": 0, "derived_default": "${:true}", "wlst_type": "integer" } ],
159-
"FreeMemoryPercentLowThreshold": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "FreeMemoryPercentLowThreshold", "wlst_path": "WP001", "default_value": 0, "derived_default": "${:true}", "wlst_type": "integer" } ],
160-
"Notes": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "default_value": null, "wlst_type": "string" } ],
161-
"PanicAction": [ {"version": "[10,12.2.1)", "wlst_mode": "both", "wlst_name": "PanicAction", "wlst_path": "WP001", "default_value": "${__NULL__:no-action}", "derived_default": "${:true}", "wlst_type": "string" } ,
162-
{"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "PanicAction", "wlst_path": "WP001", "default_value": "${__NULL__:system-exit}", "derived_default": "${:true}", "wlst_type": "string" } ],
163-
"ServerFailureTrigger": [ {"version": "[10,)", "wlst_mode": "online", "wlst_name": "ServerFailureTrigger", "wlst_path": "WP001", "default_value": null, "wlst_type": "string", "access": "IGNORED", "comment": "Appears in attribute list until ServerFailureTrigger folder is created"} ],
164-
"SharedCapacityForWorkManagers": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "SharedCapacityForWorkManagers", "wlst_path": "WP001", "default_value": 65536, "derived_default": "${:true}", "wlst_type": "integer" } ]
159+
"FailureAction": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "FailureAction", "wlst_path": "WP001", "default_value": "${__NULL__:no-action}", "derived_default": "${:true}", "wlst_type": "string" } ],
160+
"FreeMemoryPercentHighThreshold": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "FreeMemoryPercentHighThreshold", "wlst_path": "WP001", "default_value": 0, "derived_default": "${:true}", "wlst_type": "integer" } ],
161+
"FreeMemoryPercentLowThreshold": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "FreeMemoryPercentLowThreshold", "wlst_path": "WP001", "default_value": 0, "derived_default": "${:true}", "wlst_type": "integer" } ],
162+
"Notes": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "default_value": null, "wlst_type": "string" } ],
163+
"PanicAction": [ {"version": "[10,12.2.1)", "wlst_mode": "both", "wlst_name": "PanicAction", "wlst_path": "WP001", "default_value": "${__NULL__:no-action}", "derived_default": "${:true}", "wlst_type": "string" } ,
164+
{"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "PanicAction", "wlst_path": "WP001", "default_value": "${__NULL__:system-exit}", "derived_default": "${:true}", "wlst_type": "string" } ],
165+
"ServerFailureTrigger": [ {"version": "[10,)", "wlst_mode": "online", "wlst_name": "ServerFailureTrigger", "wlst_path": "WP001", "default_value": null, "wlst_type": "string", "access": "IGNORED", "comment": "Appears in attribute list until ServerFailureTrigger folder is created"} ],
166+
"SharedCapacityForWorkManagers": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "SharedCapacityForWorkManagers", "wlst_path": "WP001", "default_value": 65536, "derived_default": "${:true}", "wlst_type": "integer" } ]
165167

166168
},
167169
"wlst_attributes_path": "WP001",

0 commit comments

Comments
 (0)