Skip to content

Commit e67a10c

Browse files
authored
Deploy applications to new targets during online update (#619)
* Eliminate unneeded warning about online OHS configuration * JIRA WDT-413 Deploy applications to any new targets during online update
1 parent 97d8ff1 commit e67a10c

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

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

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"""
55
import copy
66
import os, re
7-
from java.io import ByteArrayOutputStream
87
from java.io import File
98
from java.io import FileInputStream
109
from java.io import FileNotFoundException
@@ -15,6 +14,8 @@
1514
from java.util.jar import Manifest
1615
from java.util.zip import ZipException
1716
from sets import Set
17+
18+
from oracle.weblogic.deploy.aliases import TypeUtils
1819
from wlsdeploy.aliases.location_context import LocationContext
1920
from wlsdeploy.aliases.model_constants import ABSOLUTE_SOURCE_PATH
2021
from wlsdeploy.aliases.model_constants import APPLICATION
@@ -418,6 +419,7 @@ def __get_existing_apps(self, base_location):
418419
attributes_map = self.wlst_helper.lsa()
419420
absolute_sourcepath = attributes_map['AbsoluteSourcePath']
420421
absolute_planpath = attributes_map['AbsolutePlanPath']
422+
config_targets = self.__get_config_targets()
421423

422424
# There are case in application where absolute source path is not set but sourepath is
423425
# if source path is not absolute then we need to add the domain path
@@ -442,7 +444,7 @@ def __get_existing_apps(self, base_location):
442444
else:
443445
plan_hash = None
444446

445-
_update_ref_dictionary(ref_dictionary, app, absolute_sourcepath, app_hash, None,
447+
_update_ref_dictionary(ref_dictionary, app, absolute_sourcepath, app_hash, config_targets,
446448
absolute_plan_path=absolute_planpath, deploy_order=deployment_order,
447449
plan_hash=plan_hash)
448450
return ref_dictionary
@@ -641,7 +643,23 @@ def __build_app_deploy_strategy(self, location, model_apps, existing_apps, exist
641643
existing_plan_hash = self.__get_file_hash(plan_path)
642644
if model_src_hash == existing_src_hash:
643645
if model_plan_hash == existing_plan_hash:
644-
self.__remove_app_from_deployment(model_apps, app)
646+
# If model hashes match existing hashes, the application did not change.
647+
# Unless targets were added, there's no need to redeploy.
648+
model_targets = dictionary_utils.get_element(app_dict, TARGET)
649+
model_targets_list = TypeUtils.convertToType(list, model_targets)
650+
model_targets_set = Set(model_targets_list)
651+
652+
existing_app_targets = dictionary_utils.get_element(existing_app_ref, 'target')
653+
existing_app_targets_set = Set(existing_app_targets)
654+
655+
if existing_app_targets_set.issuperset(model_targets_set):
656+
self.__remove_app_from_deployment(model_apps, app)
657+
else:
658+
# Adjust the targets to only the new targets so that existing apps on
659+
# already targeted servers are not impacted.
660+
adjusted_set = model_targets_set.difference(existing_app_targets_set)
661+
adjusted_targets = ','.join(adjusted_set)
662+
app_dict['Target'] = adjusted_targets
645663
else:
646664
# updated deployment plan
647665
stop_and_undeploy_app_list.append(app)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def add_ohs_components(self, parent_dict, location):
239239
_method_name = 'add_ohs_components'
240240

241241
system_components = dictionary_utils.get_dictionary_element(parent_dict, OHS)
242-
if self.wlst_mode == WlstModes.ONLINE:
242+
if (len(system_components) != 0) and (self.wlst_mode == WlstModes.ONLINE):
243243
self.logger.warning('WLSDPLY-09405', OHS, class_name=self._class_name, method_name=_method_name)
244244
else:
245245
self._add_named_elements(OHS, system_components, location)

0 commit comments

Comments
 (0)