@@ -500,10 +500,7 @@ def __build_app_deploy_strategy(self, location, model_apps, existing_app_refs, s
500
500
501
501
model_src_path = dictionary_utils .get_element (app_dict , SOURCE_PATH )
502
502
# determine the versioned name of the library from the application's MANIFEST
503
- # FIXME - why is from_archive always set to True???
504
- versioned_name = \
505
- self .version_helper .get_application_versioned_name (model_src_path , app , from_archive = True )
506
-
503
+ versioned_name = self .version_helper .get_application_versioned_name (model_src_path , app )
507
504
existing_app_ref = dictionary_utils .get_dictionary_element (existing_app_refs , versioned_name )
508
505
509
506
# remove deleted targets from the model and the existing app targets
@@ -818,7 +815,6 @@ def __deploy_model_deployments(self, deployments, deployments_location, deployme
818
815
for deployment_name in deploy_ordered_keys :
819
816
if not model_helper .is_delete_name (deployment_name ):
820
817
deployment_dict = deployments [deployment_name ]
821
- src_path = dictionary_utils .get_element (deployment_dict , SOURCE_PATH )
822
818
stage_mode = dictionary_utils .get_element (deployment_dict , STAGE_MODE )
823
819
targets = dictionary_utils .get_element (deployment_dict , TARGET )
824
820
@@ -833,41 +829,43 @@ def __deploy_model_deployments(self, deployments, deployments_location, deployme
833
829
self ._fixup_structured_app_plan_file_config_root (deployment_dict )
834
830
835
831
model_source_path = dictionary_utils .get_element (deployment_dict , SOURCE_PATH )
832
+ source_path = self .__get_online_deployment_path (deployment_name , deployment_type , SOURCE_PATH , model_source_path )
836
833
combined_plan_path = self ._get_combined_model_plan_path (deployment_dict )
837
- deploy_path = self .__get_online_deployment_path (model_source_path )
838
- plan_path = self .__get_online_deployment_path (combined_plan_path )
834
+ plan_path = self .__get_online_deployment_path (deployment_name , deployment_type , PLAN_PATH , combined_plan_path )
839
835
840
836
location .add_name_token (token_name , deployment_name )
841
837
resource_group_template_name , resource_group_name , partition_name = \
842
838
self ._get_mt_names_from_location (location )
843
839
844
840
module_type = dictionary_utils .get_element (deployment_dict , MODULE_TYPE )
845
841
846
- new_name = self .__deploy_app_or_library (deployment_name , deploy_path , targets , plan = plan_path ,
847
- stage_mode = stage_mode , partition = partition_name ,
842
+ new_name = self .__deploy_app_or_library (deployment_name , model_source_path , source_path , targets ,
843
+ plan = plan_path , stage_mode = stage_mode ,
844
+ partition = partition_name ,
848
845
resource_group = resource_group_name ,
849
846
resource_group_template = resource_group_template_name ,
850
847
module_type = module_type ,
851
848
sub_module_targets = sub_module_targets ,
852
849
options = options )
853
850
854
851
deployed_names .append (new_name )
855
- self ._substitute_appmodule_token (src_path , module_type )
852
+ self ._substitute_appmodule_token (model_source_path , module_type )
856
853
857
854
location .remove_name_token (token_name )
858
855
859
856
self .logger .exiting (class_name = self ._class_name , method_name = _method_name )
860
857
return deployed_names
861
858
862
- def __deploy_app_or_library (self , application_name , source_path , targets , stage_mode = None , plan = None , partition = None ,
863
- resource_group = None , resource_group_template = None , sub_module_targets = None ,
864
- module_type = None , options = None ):
859
+ def __deploy_app_or_library (self , application_name , model_source_path , deploy_source_path , targets , stage_mode = None ,
860
+ plan = None , partition = None , resource_group = None , resource_group_template = None ,
861
+ sub_module_targets = None , module_type = None , options = None ):
865
862
"""
866
863
Deploy an application or shared library in online mode.
867
864
:param application_name: the name of the app or library from the model
868
- :param source_path: the source path of the app or library
865
+ :param model_source_path: the model source path of the app or library
866
+ :param deploy_source_path: the full source path of the app or library
869
867
:param targets: the intended targets
870
- :param plan: optional, the path to the plan
868
+ :param plan: optional, the full path to the plan file
871
869
:param partition: optional, the partition
872
870
:param resource_group: optional, the resource group
873
871
:param resource_group_template: optional, the resource group template
@@ -887,42 +885,39 @@ def __deploy_app_or_library(self, application_name, source_path, targets, stage_
887
885
888
886
real_domain_home = self .model_context .get_domain_home ()
889
887
890
- if string_utils .is_empty (source_path ):
888
+ if string_utils .is_empty (model_source_path ):
891
889
ex = exception_helper .create_deploy_exception ('WLSDPLY-09317' , type_name , application_name , SOURCE_PATH )
892
890
self .logger .throwing (ex , class_name = self ._class_name , method_name = _method_name )
893
891
raise ex
894
892
895
- full_source_path = source_path
896
-
897
- if self .path_helper .is_relative_local_path (full_source_path ):
898
- full_source_path = self .path_helper .local_join (real_domain_home , source_path )
899
-
900
- if self .path_helper .is_absolute_local_path (full_source_path ) and not self .model_context .is_ssh () \
901
- and not os .path .exists (full_source_path ):
893
+ if not self .model_context .is_ssh () and self .path_helper .is_absolute_local_path (deploy_source_path ) and \
894
+ not os .path .exists (deploy_source_path ):
902
895
ex = exception_helper .create_deploy_exception ('WLSDPLY-09318' , type_name , application_name ,
903
- str_helper .to_string (full_source_path ))
896
+ str_helper .to_string (deploy_source_path ))
904
897
self .logger .throwing (ex , class_name = self ._class_name , method_name = _method_name )
905
898
raise ex
906
899
907
900
if is_library :
908
- computed_name = self .version_helper .get_library_versioned_name (source_path , application_name ,
909
- from_archive = (self .model_context .is_remote () or self .model_context .is_ssh ()))
901
+ computed_name = self .version_helper .get_library_versioned_name (model_source_path , application_name )
910
902
else :
911
- computed_name = self .version_helper .get_application_versioned_name (source_path , application_name ,
912
- module_type = module_type ,
913
- from_archive = (self .model_context .is_remote () or self .model_context .is_ssh ()))
903
+ computed_name = self .version_helper .get_application_versioned_name (model_source_path , application_name ,
904
+ module_type = module_type )
914
905
915
906
application_name = computed_name
916
907
917
908
# build the dictionary of named arguments to pass to the deploy_application method
918
909
args = list ()
919
- kwargs = {'path' : str_helper .to_string (full_source_path ), 'targets' : str_helper .to_string (targets )}
910
+ kwargs = {'path' : str_helper .to_string (deploy_source_path ), 'targets' : str_helper .to_string (targets )}
911
+ if options is not None :
912
+ is_remote = dictionary_utils .get_element (options , 'remote' ) == 'true'
913
+ else :
914
+ is_remote = False
920
915
921
916
if plan is not None :
922
917
if self .path_helper .is_relative_local_path (plan ):
923
918
plan = self .path_helper .local_join (real_domain_home , plan )
924
919
925
- if not os .path .exists (plan ):
920
+ if not is_remote and not os .path .exists (plan ):
926
921
ex = exception_helper .create_deploy_exception ('WLSDPLY-09319' , type_name , application_name , plan )
927
922
self .logger .throwing (ex , class_name = self ._class_name , method_name = _method_name )
928
923
raise ex
@@ -1165,19 +1160,25 @@ def _replace_deployments_path_tokens(self, deployment_type, deployments_dict):
1165
1160
1166
1161
self .logger .exiting (class_name = self ._class_name , method_name = _method_name )
1167
1162
1168
- def __get_online_deployment_path (self , model_path ):
1163
+ def __get_online_deployment_path (self , model_name , model_type , attribute_name , attribute_value ):
1169
1164
_method_name = '__get_online_deployment_path'
1170
- self .logger .entering (model_path , class_name = self ._class_name , method_name = _method_name )
1165
+ self .logger .entering (model_name , model_type , attribute_name , attribute_value ,
1166
+ class_name = self ._class_name , method_name = _method_name )
1171
1167
1172
- result = model_path
1173
- if not string_utils .is_empty (model_path ):
1174
- if self .archive_helper and self .archive_helper .is_path_into_archive (model_path ):
1168
+ result = attribute_value
1169
+ if not string_utils .is_empty (attribute_value ):
1170
+ if self .archive_helper and self .archive_helper .is_path_into_archive (attribute_value ):
1175
1171
if self .model_context .is_remote ():
1176
- result = self .path_helper .local_join (self .upload_temporary_dir , model_path )
1172
+ result = self .path_helper .local_join (self .upload_temporary_dir , attribute_value )
1177
1173
elif self .model_context .is_ssh ():
1178
- result = self .path_helper .remote_join (self .model_context .get_domain_home (), model_path )
1174
+ result = self .path_helper .remote_join (self .model_context .get_domain_home (), attribute_value )
1179
1175
else :
1180
- result = self .path_helper .local_join (self .model_context .get_domain_home (), model_path )
1176
+ result = self .path_helper .local_join (self .model_context .get_domain_home (), attribute_value )
1177
+ elif self .path_helper .is_relative_path (attribute_value ):
1178
+ ex = exception_helper .create_deploy_exception ('WLSDPLY-09351' , model_type , model_name ,
1179
+ attribute_name , attribute_value )
1180
+ self .logger .throwing (ex , class_name = self ._class_name , method_name = _method_name )
1181
+ raise ex
1181
1182
1182
1183
self .logger .exiting (class_name = self ._class_name , method_name = _method_name , result = result )
1183
1184
return result
0 commit comments