Skip to content

Commit eacf884

Browse files
authored
Fixonlinedeploy (#372)
* Fix online deploy * fix sourcepath or planpath that may be null if absolute path is not set.
1 parent aac628d commit eacf884

File tree

3 files changed

+40
-5
lines changed

3 files changed

+40
-5
lines changed

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

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from wlsdeploy.aliases.location_context import LocationContext
1717
from wlsdeploy.aliases.model_constants import ABSOLUTE_SOURCE_PATH
1818
from wlsdeploy.aliases.model_constants import APPLICATION
19-
from wlsdeploy.aliases.model_constants import APP_DEPLOYMENTS
2019
from wlsdeploy.aliases.model_constants import DEPLOYMENT_ORDER
2120
from wlsdeploy.aliases.model_constants import LIBRARY
2221
from wlsdeploy.aliases.model_constants import PARTITION
@@ -215,6 +214,8 @@ def __online_deploy_apps_and_libs(self, base_location):
215214
existing_libs = existing_lib_refs.keys()
216215
existing_apps = existing_app_refs.keys()
217216

217+
# stop the app if the referenced shared library is newer or
218+
# if the source path changes
218219
stop_app_list = list()
219220
stop_and_undeploy_app_list = list()
220221
update_library_list = list()
@@ -372,7 +373,8 @@ def __get_existing_apps(self, base_location):
372373

373374
self.wlst_helper.server_config()
374375
self.wlst_helper.cd(wlst_list_path)
375-
apps = self.wlst_helper.get_existing_object_list(APP_DEPLOYMENTS)
376+
apps = self.wlst_helper.get_existing_object_list()
377+
376378
self.wlst_helper.domain_runtime()
377379
#
378380
# Cannot use ApplicationRuntime since it includes datasources as ApplicationRuntimes
@@ -388,7 +390,24 @@ def __get_existing_apps(self, base_location):
388390
attributes_map = self.wlst_helper.lsa()
389391
absolute_sourcepath = attributes_map['AbsoluteSourcePath']
390392
absolute_planpath = attributes_map['AbsolutePlanPath']
393+
394+
# There are case in application where absolute source path is not set but sourepath is
395+
# if source path is not absolute then we need to add the domain path
396+
397+
if absolute_planpath is None:
398+
absolute_planpath = attributes_map['PlanPath']
399+
400+
if absolute_planpath is not None and not os.path.isabs(absolute_planpath):
401+
absolute_planpath = self.model_context.get_domain_home() + '/' + absolute_planpath
402+
403+
if absolute_sourcepath is None:
404+
absolute_sourcepath = attributes_map['SourcePath']
405+
406+
if absolute_sourcepath is not None and not os.path.isabs(absolute_sourcepath):
407+
absolute_sourcepath = self.model_context.get_domain_home() + '/' + absolute_sourcepath
408+
391409
deployment_order = attributes_map['DeploymentOrder']
410+
392411
app_hash = self.__get_file_hash(absolute_sourcepath)
393412
if absolute_planpath is not None:
394413
plan_hash = self.__get_file_hash(absolute_planpath)
@@ -436,8 +455,16 @@ def __get_library_references(self, base_location):
436455
config_attributes = self.wlst_helper.lsa()
437456
config_targets = self.__get_config_targets()
438457

439-
# TODO(jshum) - Why does the deployment plan not get considered?
458+
# There are case in application where absolute source path is not set but sourepath is
459+
# if source path is not absolute then we need to add the domain path
460+
440461
absolute_source_path = config_attributes[ABSOLUTE_SOURCE_PATH]
462+
if absolute_source_path is None:
463+
absolute_source_path = config_attributes['SourcePath']
464+
465+
if absolute_source_path is not None and not os.path.isabs(absolute_source_path):
466+
absolute_source_path = self.model_context.get_domain_home() + '/' + absolute_source_path
467+
441468
deployment_order = config_attributes[DEPLOYMENT_ORDER]
442469
lib_hash = self.__get_file_hash(absolute_source_path)
443470

@@ -569,6 +596,8 @@ def __get_file_hash(self, filename):
569596
_method_name = '__get_file_hash'
570597

571598
try:
599+
if filename is None:
600+
return None
572601
hash_value = FileUtils.computeHash(filename)
573602
except (IOException, NoSuchAlgorithmException), e:
574603
ex = exception_helper.create_deploy_exception('WLSDPLY-09309', filename, e.getLocalizedMessage(), error=e)
@@ -632,6 +661,10 @@ def __stop_app(self, application_name, partition_name=None, timeout=None):
632661
progress = self.wlst_helper.stop_application(application_name, partition=partition_name, timeout=timeout)
633662
while progress.isRunning():
634663
continue
664+
if progress.isFailed():
665+
ex = exception_helper.create_deploy_exception('WLSDPLY-09327', application_name, progress.getMessage())
666+
self.logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
667+
raise ex
635668
return
636669

637670
def __start_app(self, application_name, partition_name=None):

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ def redeploy_application(self, application_name, *args, **kwargs):
911911
_method_name = 'redeploy_application'
912912

913913
try:
914-
result = wlst_helper.redeploy_application(application_name, args, kwargs)
914+
result = wlst_helper.redeploy_application(application_name, *args, **kwargs)
915915
except PyWLSTException, pwe:
916916
ex = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-19138', application_name,
917917
pwe.getLocalizedMessage(), error=pwe)
@@ -931,7 +931,7 @@ def undeploy_application(self, application_name, *args, **kwargs):
931931
_method_name = 'undeploy_application'
932932

933933
try:
934-
result = wlst_helper.redeploy_application(application_name, args, kwargs)
934+
result = wlst_helper.undeploy_application(application_name, *args, **kwargs)
935935
except PyWLSTException, pwe:
936936
ex = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-19141', application_name,
937937
pwe.getLocalizedMessage(), error=pwe)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,8 @@ WLSDPLY-09324=Shared library {0} name has been updated to {1} to match the \
932932
implementation version in the MANIFEST.MF file
933933
WLSDPLY-09325=Failed to compute name for shared library {0} from archive at {1}: {2}
934934
WLSDPLY-09326=Deployment order is {0}
935+
WLSDPLY-09327=Failed to stop application (0): {1}
936+
935937

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

0 commit comments

Comments
 (0)