From ada06c3c43db5913d76e74426b89dc8373791864 Mon Sep 17 00:00:00 2001 From: jhonas Date: Fri, 25 Nov 2022 16:08:16 +0100 Subject: [PATCH] Fix empty TRITONSHELL_DATA_CENTERS var --- pkgs/triton-docker-env-shell.nix | 7 ++++++- tritonshell.nix | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/triton-docker-env-shell.nix b/pkgs/triton-docker-env-shell.nix index 15e4b19..5ad7bbb 100644 --- a/pkgs/triton-docker-env-shell.nix +++ b/pkgs/triton-docker-env-shell.nix @@ -6,9 +6,14 @@ with pkgs.nodePackages; # Docs: https://docs.greenbaum.cloud/en/devops/triton-cli.html # triton CLI source: https://github.com/tritonDataCenter/node-triton cnsBaseDomain=$TRITONSHELL_CNS_BASE_DOMAIN - dataCenters=$TRITONSHELL_DATA_CENTERS mantaDomain=$TRITONSHELL_MANTA_DOMAIN tritonApiDomain=$TRITONSHELL_TRITON_API_DOMAIN + if [ -n "$ZSH_VERSION" ]; then + IFS=" " read -r -A dataCenters <<< "$TRITONSHELL_DATA_CENTERS" + elif [ -n "$BASH_VERSION" ]; then + # https://github.com/koalaman/shellcheck/wiki/SC2206 + IFS=" " read -r -a dataCenters <<< "$TRITONSHELL_DATA_CENTERS" + fi # Set triton and docker host environment variables eval "$(${triton}/bin/triton env)" diff --git a/tritonshell.nix b/tritonshell.nix index 47d647c..966cd15 100644 --- a/tritonshell.nix +++ b/tritonshell.nix @@ -97,7 +97,7 @@ in extra = '' export \ TRITONSHELL_CNS_BASE_DOMAIN=${cnsBaseDomain} \ - TRITONSHELL_DATA_CENTERS=(${pkgs.lib.concatStringsSep " " dataCenters}) \ + TRITONSHELL_DATA_CENTERS="${pkgs.lib.concatStringsSep " " dataCenters}" \ TRITONSHELL_MANTA_DOMAIN=${mantaDomain} \ TRITONSHELL_TRITON_API_DOMAIN=${tritonApiDomain} if [ -z "$TRITON_DONT_SOURCE_PROFILE" ]; then