Skip to content

Commit 0057334

Browse files
committed
fix scripts
1 parent 44bde0f commit 0057334

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

cfn-resources/flex-cluster/test/cfn-test-create-inputs.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ set -o nounset
99
set -o pipefail
1010

1111
function usage {
12-
echo "usage:$0 <project_id>"
13-
echo "Adjust flex cluster test input files"
12+
echo "usage:$0 <project_name>"
13+
echo "Generates test input files for flex cluster using an existing project"
1414
exit 0
1515
}
1616

@@ -27,7 +27,15 @@ if [ ${MONGODB_ATLAS_PROFILE+x} ]; then
2727
profile=${MONGODB_ATLAS_PROFILE}
2828
fi
2929

30-
projectId="${1}"
30+
projectName="${1}"
31+
projectId=$(atlas projects list --output json | jq --arg NAME "${projectName}" -r '.results[] | select(.name==$NAME) | .id')
32+
if [ -z "$projectId" ]; then
33+
echo "ERROR: Project \"${projectName}\" does not exist. Please create the project first."
34+
exit 1
35+
else
36+
echo -e "FOUND project \"${projectName}\" with id: ${projectId}\n"
37+
fi
38+
3139
clusterName="cfn-test-bot-$((1 + RANDOM % 10000))"
3240
echo "clusterName: $clusterName"
3341

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
# cfn-test-delete-inputs.sh
3+
#
4+
# Needs to exist to be called in Publish, but no cleanup is needed.

cfn-resources/flex-cluster/test/contract-testing/cfn-test-create.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ projectId=$(atlas projects create "${projectName}" --output=json | jq -r '.id')
1313
echo "projectId: $projectId"
1414
echo "projectName: $projectName"
1515

16-
./test/cfn-test-create-inputs.sh "$projectId"
16+
./test/cfn-test-create-inputs.sh "$projectName"

0 commit comments

Comments
 (0)