1616from wlsdeploy .aliases .location_context import LocationContext
1717from wlsdeploy .aliases .model_constants import ABSOLUTE_SOURCE_PATH
1818from wlsdeploy .aliases .model_constants import APPLICATION
19- from wlsdeploy .aliases .model_constants import APP_DEPLOYMENTS
2019from wlsdeploy .aliases .model_constants import DEPLOYMENT_ORDER
2120from wlsdeploy .aliases .model_constants import LIBRARY
2221from 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 ):
0 commit comments