From 6e33c55fc83431b80af2937f7a22d7f2343bb304 Mon Sep 17 00:00:00 2001 From: Fran Slot Date: Fri, 15 Dec 2023 09:53:45 +0100 Subject: [PATCH 1/2] Replace special characters in student name with hyphen --- RAP4/customizations/bootstrap/files/ExecEngineFunctions.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/RAP4/customizations/bootstrap/files/ExecEngineFunctions.php b/RAP4/customizations/bootstrap/files/ExecEngineFunctions.php index 138faaa5..5dc38435 100644 --- a/RAP4/customizations/bootstrap/files/ExecEngineFunctions.php +++ b/RAP4/customizations/bootstrap/files/ExecEngineFunctions.php @@ -320,7 +320,10 @@ * - run kubectl apply -f "student-manifest-{{student}}.yaml" */ + $pattern = "\W+"; + $studentName=strtolower($userName); + $studentName = preg_replace($pattern, "-", $studentName); $namespace=getenv('RAP_KUBERNETES_NAMESPACE'); $containerImage=getenv('RAP_STUDENT_PROTO_IMAGE'); From 5960b42625ce756a86d83c0d9be55a36fb9034ec Mon Sep 17 00:00:00 2001 From: Fran Slot Date: Fri, 15 Dec 2023 11:18:25 +0100 Subject: [PATCH 2/2] Missing slash in pattern --- RAP4/customizations/bootstrap/files/ExecEngineFunctions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RAP4/customizations/bootstrap/files/ExecEngineFunctions.php b/RAP4/customizations/bootstrap/files/ExecEngineFunctions.php index 5dc38435..31cd862b 100644 --- a/RAP4/customizations/bootstrap/files/ExecEngineFunctions.php +++ b/RAP4/customizations/bootstrap/files/ExecEngineFunctions.php @@ -320,10 +320,10 @@ * - run kubectl apply -f "student-manifest-{{student}}.yaml" */ - $pattern = "\W+"; + $pattern = '/[\W+]/'; $studentName=strtolower($userName); - $studentName = preg_replace($pattern, "-", $studentName); + $studentName = preg_replace($pattern, '-', $studentName); $namespace=getenv('RAP_KUBERNETES_NAMESPACE'); $containerImage=getenv('RAP_STUDENT_PROTO_IMAGE');