Skip to content

Commit 994a49b

Browse files
committed
Update cortex.sh
1 parent c5835f0 commit 994a49b

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

cortex.sh

+26-22
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ export CORTEX_IMAGE_DOWNLOADER="${CORTEX_IMAGE_DOWNLOADER:-cortexlabs/downloader
132132
export CORTEX_ENABLE_TELEMETRY="${CORTEX_ENABLE_TELEMETRY:-""}"
133133
export CORTEX_TELEMETRY_URL="${CORTEX_TELEMETRY_URL:-"https://telemetry.cortexlabs.dev"}"
134134

135-
AWS_KEY_SOURCE_STR=""
136-
OPERATOR_AWS_KEY_SOURCE_STR=""
137-
138135
function set_aws_credentials_from_cli() {
139136
if ! command -v aws >/dev/null; then
140137
return
@@ -148,13 +145,11 @@ function set_aws_credentials_from_cli() {
148145

149146
export AWS_ACCESS_KEY_ID=$(aws --profile default configure get aws_access_key_id)
150147
export AWS_SECRET_ACCESS_KEY=$(aws --profile default configure get aws_secret_access_key)
151-
152-
AWS_KEY_SOURCE_STR=" (from AWS CLI's default profile)"
153148
}
154149

155150
function set_aws_credentials() {
156151
if [ "$AWS_ACCESS_KEY_ID" != "" ] && [ "$AWS_SECRET_ACCESS_KEY" != "" ]; then
157-
AWS_KEY_SOURCE_STR=" (from environment variable)"
152+
true
158153
elif [ "$AWS_ACCESS_KEY_ID" == "" ] && [ "$AWS_SECRET_ACCESS_KEY" != "" ]; then
159154
echo -e "\nPlease run \`export AWS_ACCESS_KEY_ID=***\`"
160155
exit 1
@@ -171,7 +166,7 @@ function set_aws_credentials() {
171166
fi
172167

173168
if [ "$CORTEX_AWS_ACCESS_KEY_ID" != "" ] && [ "$CORTEX_AWS_SECRET_ACCESS_KEY" != "" ]; then
174-
OPERATOR_AWS_KEY_SOURCE_STR=" (from environment variable)"
169+
true
175170
elif [ "$CORTEX_AWS_ACCESS_KEY_ID" != "" ] || [ "$CORTEX_AWS_SECRET_ACCESS_KEY" != "" ]; then
176171
echo -e "\nPlease export both CORTEX_AWS_ACCESS_KEY_ID and CORTEX_AWS_SECRET_ACCESS_KEY"
177172
exit 1
@@ -186,19 +181,30 @@ if [ "$arg2" != "cli" ]; then
186181
fi
187182

188183
if [ "$arg1" = "install" ] && [ "$arg2" = "" ] && [ "$arg3" = "" ]; then
189-
echo -e "\nConfiguration"
190-
echo " ○ cluster name: $CORTEX_CLUSTER"
191-
echo " ○ region: $CORTEX_REGION"
192-
echo " ○ instance type: $CORTEX_NODE_TYPE"
193-
echo " ○ min nodes: $CORTEX_NODES_MIN"
194-
echo " ○ max nodes: $CORTEX_NODES_MAX"
195-
echo " ○ bucket: $CORTEX_BUCKET"
196-
echo " ○ log group: $CORTEX_LOG_GROUP"
197-
echo " ○ AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}${AWS_KEY_SOURCE_STR}"
198-
184+
echo
185+
echo "○ cluster name: $CORTEX_CLUSTER"
186+
echo "○ region: $CORTEX_REGION"
187+
echo "○ bucket: "${CORTEX_BUCKET:-autogenerate}""
188+
echo "○ log group: $CORTEX_LOG_GROUP"
189+
echo "○ instance type: $CORTEX_NODE_TYPE"
190+
echo "○ min nodes: $CORTEX_NODES_MIN"
191+
echo "○ max nodes: $CORTEX_NODES_MAX"
192+
echo "○ AWS access key ID: ${AWS_ACCESS_KEY_ID}"
199193
if [ "$CORTEX_AWS_ACCESS_KEY_ID" != "$AWS_ACCESS_KEY_ID" ]; then
200-
echo " ○ Operator AWS_ACCESS_KEY_ID: ${CORTEX_AWS_ACCESS_KEY_ID}${OPERATOR_AWS_KEY_SOURCE_STR}"
194+
echo "○ Operator AWS access key ID: ${CORTEX_AWS_ACCESS_KEY_ID}"
201195
fi
196+
197+
while true; do
198+
echo
199+
read -p "Is the configuration above correct? [Y/n] " -n 1 -r
200+
echo
201+
if [[ $REPLY =~ ^[Yy]$ ]]; then
202+
break
203+
elif [[ $REPLY =~ ^[Nn]$ ]]; then
204+
exit 1
205+
fi
206+
echo "Unexpected value, please enter \"Y\" or \"n\""
207+
done
202208
fi
203209

204210
##########################
@@ -432,8 +438,7 @@ function prompt_for_email() {
432438

433439
function prompt_for_telemetry() {
434440
if [ "$CORTEX_ENABLE_TELEMETRY" != "true" ] && [ "$CORTEX_ENABLE_TELEMETRY" != "false" ]; then
435-
while true
436-
do
441+
while true; do
437442
echo
438443
read -p "Would you like to help improve Cortex by anonymously sending error reports and cluster usage stats to the dev team? [Y/n] " -n 1 -r
439444
echo
@@ -450,8 +455,7 @@ function prompt_for_telemetry() {
450455
}
451456

452457
function confirm_for_uninstall() {
453-
while true
454-
do
458+
while true; do
455459
echo
456460
read -p "Are you sure you want to uninstall Cortex? (Your cluster will be spun down and all APIs will be deleted) [Y/n] " -n 1 -r
457461
echo

0 commit comments

Comments
 (0)