Skip to content

Commit a36605e

Browse files
committed
Merge branch 'gh-1547' into 'main'
adding protection around getting/setting the plan name when the plan is not specified See merge request weblogic-cloud/weblogic-deploy-tooling!1672
2 parents d40fa09 + 25372cc commit a36605e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Diff for: core/src/main/python/wlsdeploy/tool/discover/deployments_discoverer.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -611,10 +611,9 @@ def _get_plan_path(self, plan_path, archive_file, app_source_name, application_n
611611
self.download_temporary_dir,
612612
"applications")
613613

614-
new_plan_name = archive_file.addApplicationDeploymentPlan(plan_file_name,
615-
_generate_new_plan_name(
616-
app_source_name,
617-
plan_file_name))
614+
new_plan_name = _generate_new_plan_name(app_source_name, plan_file_name)
615+
if new_plan_name is not None:
616+
new_plan_name = archive_file.addApplicationDeploymentPlan(plan_file_name, new_plan_name)
618617
except IllegalArgumentException, iae:
619618
_logger.warning('WLSDPLY-06395', application_name, plan_file_name,
620619
iae.getLocalizedMessage(), class_name=_class_name,
@@ -706,8 +705,10 @@ def _generate_new_plan_name(binary_path, plan_path):
706705
:return: newly generated plan name for the archive file
707706
"""
708707
_path_helper = path_helper.get_path_helper()
709-
new_name = _path_helper.get_filename_from_path(plan_path)
710-
if binary_path is not None:
711-
prefix = _path_helper.get_filename_no_ext_from_path(binary_path)
712-
new_name = prefix + '-' + new_name
708+
new_name = None
709+
if not string_utils.is_empty(plan_path):
710+
new_name = _path_helper.get_filename_from_path(plan_path)
711+
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
713714
return new_name

0 commit comments

Comments
 (0)