From eee7b630a80ad6ff7440fe994792c138dd1636df Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 13 Mar 2023 17:39:32 +0100 Subject: [PATCH] appsv2: don't miserably crash when failing to convert port number because of syntaxes such as $port+1 --- packaging_v2/convert_app_to_packaging_v2.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packaging_v2/convert_app_to_packaging_v2.py b/packaging_v2/convert_app_to_packaging_v2.py index dfba8cf..39a5b44 100644 --- a/packaging_v2/convert_app_to_packaging_v2.py +++ b/packaging_v2/convert_app_to_packaging_v2.py @@ -180,6 +180,10 @@ def _convert_v1_manifest_to_v2(app_path): if name == "port": name = "main" + if not default.isdigit(): + print(f"Failed to parse '{default}' as a port number ... Will use 12345 instead") + default = 12345 + manifest["resources"]["ports"][f"{name}.default"] = int(default) if exposed: manifest["resources"]["ports"][f"{name}.exposed"] = exposed