@@ -696,19 +696,32 @@ def _get_dictionary_attribute_with_path_tokens_replaced(self, model_dict, attrib
696696
697697def _generate_new_plan_name (binary_path , plan_path ):
698698 """
699- Generate a new plan name from the plan path and binary path.
699+ Generate a new plan name from the plan path and binary path. This is always invoked using local file names.
700700
701701 This is a private helper method.
702702
703703 :param binary_path: source path of the deployment file
704704 :param plan_path: path of the plan from the domain
705705 :return: newly generated plan name for the archive file
706706 """
707+ _method_name = '_generate_new_plan_name'
708+ _logger .entering (binary_path , plan_path , class_name = _class_name , method_name = _method_name )
709+
707710 _path_helper = path_helper .get_path_helper ()
708711 new_name = None
709712 if not string_utils .is_empty (plan_path ):
710- new_name = _path_helper .get_filename_from_path (plan_path )
713+ new_name = _path_helper .get_local_filename_from_path (plan_path )
711714 if binary_path is not None and new_name is not None :
712- prefix = _path_helper .get_filename_no_ext_from_path (binary_path )
713- new_name = prefix + '-' + new_name
715+ if os .path .isfile (binary_path ):
716+ prefix = _path_helper .get_local_filename_no_ext_from_path (binary_path )
717+ else :
718+ # Unlike the Unix shell, basename on a path that ends in a directory separator
719+ # returns an empty string so remove them...
720+ while binary_path .endswith ('/' ) or binary_path .endswith ('\\ ' ):
721+ binary_path = binary_path [0 :- 1 ]
722+ prefix = _path_helper .local_basename (binary_path )
723+
724+ new_name = '%s-%s' % (prefix , new_name )
725+
726+ _logger .exiting (class_name = _class_name , method_name = _method_name , result = new_name )
714727 return new_name
0 commit comments