Skip to content

Commit 2d85bdf

Browse files
Redploy automatically if war at same physical location as domain loca… (#937)
1 parent a0048e0 commit 2d85bdf

File tree

2 files changed

+29
-21
lines changed

2 files changed

+29
-21
lines changed

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

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -667,28 +667,35 @@ def __build_app_deploy_strategy(self, location, model_apps, existing_app_refs, s
667667
existing_plan_hash = self.__get_file_hash(plan_path)
668668
if model_src_hash == existing_src_hash:
669669
if model_plan_hash == existing_plan_hash:
670-
# If model hashes match existing hashes, the application did not change.
671-
# Unless targets were added, there's no need to redeploy.
672-
model_targets = dictionary_utils.get_element(app_dict, TARGET)
673-
model_targets_list = alias_utils.create_list(model_targets, 'WLSDPLY-08000')
674-
model_targets_set = Set(model_targets_list)
675-
676-
existing_app_targets = dictionary_utils.get_element(existing_app_ref, 'target')
677-
existing_app_targets_set = Set(existing_app_targets)
678-
679-
if existing_app_targets_set.issuperset(model_targets_set):
680-
self.__remove_app_from_deployment(model_apps, app)
670+
if not (os.path.isabs(src_path) and os.path.isabs(model_src_path) and
671+
FileUtils.getCanonicalPath(src_path) == FileUtils.getCanonicalPath(model_src_path)):
672+
# If model hashes match existing hashes, the application did not change.
673+
# Unless targets were added, there's no need to redeploy.
674+
# If it is an absolute path, there is nothing to compare so assume redeploy
675+
model_targets = dictionary_utils.get_element(app_dict, TARGET)
676+
model_targets_list = alias_utils.create_list(model_targets, 'WLSDPLY-08000')
677+
model_targets_set = Set(model_targets_list)
678+
679+
existing_app_targets = dictionary_utils.get_element(existing_app_ref, 'target')
680+
existing_app_targets_set = Set(existing_app_targets)
681+
682+
if existing_app_targets_set.issuperset(model_targets_set):
683+
self.__remove_app_from_deployment(model_apps, app)
684+
else:
685+
# Adjust the targets to only the new targets so that existing apps on
686+
# already targeted servers are not impacted.
687+
adjusted_set = model_targets_set.difference(existing_app_targets_set)
688+
adjusted_targets = ','.join(adjusted_set)
689+
app_dict['Target'] = adjusted_targets
690+
691+
# For update case, the sparse model may be just changing targets, therefore without sourcepath
692+
693+
if app_dict['SourcePath'] is None and src_path is not None:
694+
app_dict['SourcePath'] = src_path
681695
else:
682-
# Adjust the targets to only the new targets so that existing apps on
683-
# already targeted servers are not impacted.
684-
adjusted_set = model_targets_set.difference(existing_app_targets_set)
685-
adjusted_targets = ','.join(adjusted_set)
686-
app_dict['Target'] = adjusted_targets
687-
688-
# For update case, the sparse model may be just changing targets, therefore without sourcepath
689-
690-
if app_dict['SourcePath'] is None and src_path is not None:
691-
app_dict['SourcePath'] = src_path
696+
self.logger.info('WLSDPLY-09336', src_path,
697+
class_name=self._class_name, method_name=_method_name)
698+
stop_and_undeploy_app_list.append(versioned_name)
692699
else:
693700
# updated deployment plan
694701
stop_and_undeploy_app_list.append(versioned_name)

core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,7 @@ WLSDPLY-09332=Application {0} not found, found similar names {1}. For deleting
11151115
WLSDPLY-09333=Library {0} not found. Please specify a valid library for deletion
11161116
WLSDPLY-09334=Application {0} not found. Please specify a valid application for deletion
11171117
WLSDPLY-09335=Undeploying {0} {1} from targets: {2}
1118+
WLSDPLY-09336=Redeployed application {0} because the old and the new binary have the same path.
11181119

11191120
# wlsdeploy/tool/deploy/common_resources_deployer.py
11201121
WLSDPLY-09400=ResourceGroup was specified in the test file but are not supported in WebLogic Server version {0}

0 commit comments

Comments
 (0)