Skip to content

Commit 8bffe6f

Browse files
committed
Fix three install.sh issues found in PR review
- _prompt_yn now shows which option Enter accepts ([Y/N, Enter=Y]) instead of the ambiguous static [Y/N] hint - PROFILES_EXIT is now captured correctly by running databricks auth profiles before the pipeline so the exit code reaches the parent shell (process substitution subshell prevented the original assignment) - MLflow experiment path is passed via sys.argv / os.environ instead of shell-interpolated into Python/JSON literals, preventing breakage on paths containing single or double quotes Co-authored-by: Isaac
1 parent 42d4722 commit 8bffe6f

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

scripts/install.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ _prompt_yn() {
6060
local default="${3:-Y}"
6161
local result
6262

63-
local yn_hint="[Y/N]"
63+
local yn_hint="[Y/N, Enter=${default}]"
6464
echo -en " ${prompt_text} ${yn_hint}: "
6565
read -r result
6666
result="${result:-$default}"
@@ -198,6 +198,7 @@ DEFAULT_VALID="NO"
198198
LOGGEDIN_NAMES=()
199199
NOTLOGGEDIN_NAMES=()
200200
PROFILES_EXIT=0
201+
PROFILES_OUTPUT=$(databricks auth profiles 2>/dev/null) || PROFILES_EXIT=1
201202
while IFS= read -r line; do
202203
[ -z "$line" ] && continue
203204
name=$(echo "$line" | awk '{print $1}')
@@ -210,7 +211,7 @@ while IFS= read -r line; do
210211
else
211212
NOTLOGGEDIN_NAMES+=("$name")
212213
fi
213-
done < <(databricks auth profiles 2>/dev/null | tail -n +2 | grep -v '^$' || { PROFILES_EXIT=1; true; })
214+
done < <(echo "$PROFILES_OUTPUT" | tail -n +2 | grep -v '^$' || true)
214215

215216
# Build ordered selection array: DEFAULT first, then logged-in, then not-logged-in
216217
ORDERED_PROFILES=("DEFAULT")
@@ -511,11 +512,13 @@ except: pass
511512
_info "Creating MLflow experiment..."
512513
_info "Press Enter to accept the default path, or type a custom one."
513514
_prompt EXPERIMENT_PATH "Experiment path" "/Shared/genie-workbench-agent-tracing"
515+
# Build JSON safely so paths with quotes/special chars don't break the payload
516+
MLFLOW_CREATE_JSON=$(python3 -c "import json,sys; print(json.dumps({'name': sys.argv[1]}))" "$EXPERIMENT_PATH")
514517
# Try to create the experiment
515518
MLFLOW_EXPERIMENT_ID=$(
516519
databricks api post /api/2.0/mlflow/experiments/create \
517520
--profile "$PROFILE" \
518-
--json "{\"name\": \"$EXPERIMENT_PATH\"}" -o json 2>/dev/null \
521+
--json "$MLFLOW_CREATE_JSON" -o json 2>/dev/null \
519522
| python3 -c "import sys,json; print(json.load(sys.stdin).get('experiment_id',''))" 2>/dev/null || true
520523
)
521524
# If creation failed (e.g. already exists), look it up by name
@@ -524,9 +527,9 @@ except: pass
524527
databricks api post /api/2.0/mlflow/experiments/search \
525528
--profile "$PROFILE" \
526529
--json '{"max_results": 100}' -o json 2>/dev/null \
527-
| python3 -c "
528-
import sys, json
529-
path = '$EXPERIMENT_PATH'
530+
| EXPERIMENT_PATH="$EXPERIMENT_PATH" python3 -c "
531+
import sys, json, os
532+
path = os.environ['EXPERIMENT_PATH']
530533
try:
531534
for e in json.load(sys.stdin).get('experiments', []):
532535
if e.get('name','') == path:

0 commit comments

Comments
 (0)