From e77a375758c7d3147a8eaa95aabb5c9c6cb5fce2 Mon Sep 17 00:00:00 2001 From: Thibault Camalon <135698225+thbcmlowk@users.noreply.github.com> Date: Thu, 23 May 2024 10:09:58 +0200 Subject: [PATCH] chore(charts/substra-backend): handle whitespaced orgnames Signed-off-by: Thibault Camalon <135698225+thbcmlowk@users.noreply.github.com> --- .../templates/job-migrations.yaml | 17 +++++++++++------ examples/values/backend-org-1.yaml | 8 ++++---- examples/values/backend-org-2.yaml | 4 ++-- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/charts/substra-backend/templates/job-migrations.yaml b/charts/substra-backend/templates/job-migrations.yaml index f4bef35a4..96ed6127d 100644 --- a/charts/substra-backend/templates/job-migrations.yaml +++ b/charts/substra-backend/templates/job-migrations.yaml @@ -42,16 +42,21 @@ spec: done < /accounts/users ## IncomingOrganization - while read -r user_password; do - read user password <<< "$user_password" - ./manage.py create_incoming_organization "$user" "$password" + while IFS= read -r line; do + # Extract the password as the last word + password=$(echo "$line" | awk '{print $NF}') + # Extract the username by removing the last word + user=$(echo "$line" | sed 's/ [^ ]*$//') done < /accounts/incoming_organizations ## OutgoingOrganization - while read -r user_password; do - read user password <<< "$user_password" - ./manage.py create_outgoing_organization "$user" "$password" + while IFS= read -r line; do + # Extract the password as the last word + password=$(echo "$line" | awk '{print $NF}') + # Extract the username by removing the last word + user=$(echo "$line" | sed 's/ [^ ]*$//') done < /accounts/outgoing_organizations + envFrom: - configMapRef: name: {{ include "substra.fullname" . }}-orchestrator diff --git a/examples/values/backend-org-1.yaml b/examples/values/backend-org-1.yaml index a48251a6f..139517d63 100644 --- a/examples/values/backend-org-1.yaml +++ b/examples/values/backend-org-1.yaml @@ -7,7 +7,7 @@ config: DEFAULT_THROTTLE_RATES: "120" TASK_CACHE_DOCKER_IMAGES: "False" LOG_LEVEL: DEBUG -organizationName: MyOrg1 +organizationName: FirstOrg # set the same creds as in localdev so they're the same everywhere in dev database: @@ -72,11 +72,11 @@ kaniko: addAccountOperator: incomingOrganizations: - - { name: MyOrg1MSP, secret: selfSecret1 } + - { name: First Organization, secret: selfSecret1 } - { name: MyOrg2MSP, secret: organizationSecret1w2 } - { name: MyOrg3MSP, secret: organizationSecret1w3 } outgoingOrganizations: - - { name: MyOrg1MSP, secret: selfSecret1 } + - { name: First Organization, secret: selfSecret1 } - { name: MyOrg2MSP, secret: organizationSecret2w1 } - { name: MyOrg3MSP, secret: organizationSecret3w1 } @@ -121,7 +121,7 @@ orchestrator: mtls: enabled: true clientCertificate: orchestrator-tls-client-pair - mspID: MyOrg1MSP + mspID: First Organization channels: - mychannel: restricted: false diff --git a/examples/values/backend-org-2.yaml b/examples/values/backend-org-2.yaml index 334687e9c..132129392 100644 --- a/examples/values/backend-org-2.yaml +++ b/examples/values/backend-org-2.yaml @@ -72,11 +72,11 @@ kaniko: addAccountOperator: incomingOrganizations: - - { name: MyOrg1MSP, secret: organizationSecret2w1 } + - { name: First Organization, secret: organizationSecret2w1 } - { name: MyOrg2MSP, secret: selfSecret2 } - { name: MyOrg3MSP, secret: organizationSecret2w3 } outgoingOrganizations: - - { name: MyOrg1MSP, secret: organizationSecret1w2 } + - { name: First Organization, secret: organizationSecret1w2 } - { name: MyOrg2MSP, secret: selfSecret2 } - { name: MyOrg3MSP, secret: organizationSecret3w2 }