From 3884c24e4817e4a2354998b096e0e69d9e7fa0aa Mon Sep 17 00:00:00 2001 From: Derek Smith Date: Thu, 23 Mar 2023 14:25:31 -0400 Subject: [PATCH] Iterate over projects in show.sh --- deployment/show.sh | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/deployment/show.sh b/deployment/show.sh index 2ce9acd..f6d20cb 100755 --- a/deployment/show.sh +++ b/deployment/show.sh @@ -1,13 +1,36 @@ #!/bin/bash -echo "LXD REMOTE: $(lxc remote get-default)" +set -eu +cd "$(dirname "$0")" -lxc project list +. ../defaults.sh +. ./remote_env.sh + + +echo "Global Settings:" + +lxc image list lxc storage list lxc storage volume list ss-base -lxc image list -lxc project list -lxc network list -lxc profile list -lxc list \ No newline at end of file + +echo +echo + +for PROJECT_CHAIN in ${DEPLOYMENT_STRING//,/ }; do + NO_PARENS="${PROJECT_CHAIN:1:${#PROJECT_CHAIN}-2}" + PROJECT_PREFIX=$(echo "$NO_PARENS" | cut -d'|' -f1) + BITCOIN_CHAIN=$(echo "$NO_PARENS" | cut -d'|' -f2) + PROJECT_NAME="$PROJECT_PREFIX-$BITCOIN_CHAIN" + + if ! lxc info | grep "project:" | grep -q "$PROJECT_NAME"; then + if lxc project list | grep -q "$PROJECT_NAME"; then + lxc project switch "$PROJECT_NAME" + fi + fi + + lxc network list + lxc profile list + lxc list + +done \ No newline at end of file