From 09c1d01c98ed1eeacce1f2bff23fe166b085e8bb Mon Sep 17 00:00:00 2001 From: Giacomo Marciani Date: Fri, 15 Dec 2023 10:37:16 +0100 Subject: [PATCH] [Tools] Make `setup-env.sh` create files with the right extensions (yaml) and emit more explicative logs. --- scripts/setup-env.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/setup-env.sh b/scripts/setup-env.sh index eccec01c..11b92140 100755 --- a/scripts/setup-env.sh +++ b/scripts/setup-env.sh @@ -31,15 +31,22 @@ ENVIRONMENT=$1 info "Selected environment: $ENVIRONMENT" -if [[ $(ls $ENVIRONMENTS_DIR/$ENVIRONMENT-*) ]]; then - warn "Configuration files for the environment $ENVIRONMENT already exist. Nothing to do." +if [[ $(ls $ENVIRONMENTS_DIR/$ENVIRONMENT-* 2>/dev/null) ]]; then + warn "Configuration files for the environment $ENVIRONMENT already exist in $ENVIRONMENTS_DIR . Nothing to do." exit 0 fi info "Creating environment files" -cp "$ENVIRONMENTS_DIR/demo-variables.sh" "$ENVIRONMENTS_DIR/$ENVIRONMENT-variables.sh" +VARIABLES_FILE="$ENVIRONMENTS_DIR/$ENVIRONMENT-variables.sh" +CFN_CREATE_FILE="$ENVIRONMENTS_DIR/$ENVIRONMENT-cfn-create-args.yaml" +CFN_UPDATE_FILE="$ENVIRONMENTS_DIR/$ENVIRONMENT-cfn-update-args.yaml" +cp "$ENVIRONMENTS_DIR/demo-variables.sh" "$VARIABLES_FILE" chmod +x "$ENVIRONMENTS_DIR/$ENVIRONMENT-variables.sh" -cp "$ENVIRONMENTS_DIR/demo-cfn-update-args.yaml" "$ENVIRONMENTS_DIR/$ENVIRONMENT-cfn-create-args.sh" -cp "$ENVIRONMENTS_DIR/demo-cfn-update-args.yaml" "$ENVIRONMENTS_DIR/$ENVIRONMENT-cfn-update-args.sh" - -info "Environment files created! Check out $ENVIRONMENTS_DIR" \ No newline at end of file +cp "$ENVIRONMENTS_DIR/demo-cfn-create-args.yaml" "$CFN_CREATE_FILE" +cp "$ENVIRONMENTS_DIR/demo-cfn-update-args.yaml" "$CFN_UPDATE_FILE" + +info "Environment files created! Check them out and adapt with your values: + * $VARIABLES_FILE + * $CFN_CREATE_FILE + * $CFN_UPDATE_FILE +" \ No newline at end of file