From bcfa236c551b4f0fd405eb918d370230313560ad Mon Sep 17 00:00:00 2001 From: Rudi Schlatte Date: Mon, 8 Apr 2024 10:11:48 +0200 Subject: [PATCH] Make app name safe for use as unquoted filename ... DeployApplicaiton endpoint requirement now documented after seeing mysterious deployment failures Change-Id: I27a162ae3c50f2cfdd8ab46a95880b9ca692e246 --- .../optimiser/controller/NebulousAppDeployer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/optimiser-controller/src/main/java/eu/nebulouscloud/optimiser/controller/NebulousAppDeployer.java b/optimiser-controller/src/main/java/eu/nebulouscloud/optimiser/controller/NebulousAppDeployer.java index f91474a..1a9bdb3 100644 --- a/optimiser-controller/src/main/java/eu/nebulouscloud/optimiser/controller/NebulousAppDeployer.java +++ b/optimiser-controller/src/main/java/eu/nebulouscloud/optimiser/controller/NebulousAppDeployer.java @@ -162,6 +162,10 @@ public class NebulousAppDeployer { public static void deployApplication(NebulousApp app, JsonNode kubevela) { String appUUID = app.getUUID(); String clusterName = app.getClusterName(); + // The application name is typed in by the user, and is used + // internally by SAL as an unquoted filename in a generated shell + // script. It shouldn't be this way but it is what it is. + String safeAppName = app.getName().replaceAll("[^a-zA-Z0-9-_]", "_"); ExnConnector conn = app.getExnConnector(); log.info("Starting initial deployment for application", keyValue("appId", appUUID), keyValue("clusterName", clusterName)); @@ -376,7 +380,7 @@ public class NebulousAppDeployer { // 7. Deploy application log.info("Calling deployApplication", keyValue("appId", appUUID), keyValue("clusterName", clusterName)); - long proActiveJobID = conn.deployApplication(appUUID, clusterName, app.getName(), rewritten_kubevela); + long proActiveJobID = conn.deployApplication(appUUID, clusterName, safeAppName, rewritten_kubevela); log.info("deployApplication returned ProActive Job ID {}", proActiveJobID, keyValue("appId", appUUID), keyValue("clusterName", clusterName)); if (proActiveJobID == 0) {