Skip to content

Commit c0760c1

Browse files
committed
Revert sethome absolute-path fix and regenerated outputs
The absolute-path resolution (cd && pwd) introduced in 81d9297 works on macOS/Linux but emits Unix-style /c/... paths on Git Bash, which the native Windows Go binary can't open; the follow-up adb452f fixed the CLI path with `pwd -W` but broke tests like cmd/completion that compare the bash $HOME placeholder against the CLI's USERPROFILE-derived output. Revert sethome to the original simple form and restore the four outputs regenerated in f893006 to their pre-fix relative-./home forms. bundle_default_profile keeps its sub-cases but the cd'ing variants short-circuit on a missing cfg again (same expected output as before 81d9297). A separate PR will revisit the test setup to make absolute HOME work cleanly across platforms. Co-authored-by: Isaac
1 parent adb452f commit c0760c1

6 files changed

Lines changed: 23 additions & 32 deletions

File tree

acceptance/auth/bundle_default_profile/output.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ Exit code: 1
2323
=== Bundle with workspace.host: default_profile is NOT applied
2424

2525
>>> errcode [CLI] bundle validate -o json
26+
Error: failed during request visitor: default auth: cannot configure default credentials, please check https://docs.databricks.com/en/dev-tools/auth.html#databricks-client-unified-authentication to configure credentials for your preferred authentication method. Config: host=[DATABRICKS_URL], workspace_id=[NUMID], databricks_cli_path=[CLI]. Env: DATABRICKS_CLI_PATH
27+
28+
29+
Exit code: 1
2630
{
2731
"host": "[DATABRICKS_URL]",
2832
"profile": null
@@ -31,7 +35,7 @@ Exit code: 1
3135
=== Bundle with workspace.profile: pinned profile wins over default_profile
3236

3337
>>> errcode [CLI] bundle validate -o json
34-
Error: Get "https://other.test/api/2.0/preview/scim/v2/Me": (redacted)
38+
Error: failed during request visitor: default auth: cannot configure default credentials, please check https://docs.databricks.com/en/dev-tools/auth.html#databricks-client-unified-authentication to configure credentials for your preferred authentication method. Config: profile=other, databricks_cli_path=[CLI]. Env: DATABRICKS_CLI_PATH
3539

3640

3741
Exit code: 1

acceptance/cmd/auth/describe/u2m-plaintext-config/output.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
>>> [CLI] auth describe --profile u2m-profile
33
Warn: [hostmetadata] failed to fetch host metadata for https://u2m-profile.databricks.test, will skip for 1m0s
44
Unable to authenticate: error getting token: cache: token not found
5-
Token storage: plaintext, ~/.databricks/token-cache.json (from auth_storage in [__settings__] section of [TEST_TMP_DIR]/home/.databrickscfg)
5+
Token storage: plaintext, ~/.databricks/token-cache.json (from auth_storage in [__settings__] section of home/.databrickscfg)
66
-----
77
Current configuration:
8-
✓ host: https://u2m-profile.databricks.test (from [TEST_TMP_DIR]/home/.databrickscfg config file)
8+
✓ host: https://u2m-profile.databricks.test (from ./home/.databrickscfg config file)
99
✓ profile: u2m-profile (from --profile flag)
1010
✓ databricks_cli_path: [CLI]
11-
✓ auth_type: databricks-cli (from [TEST_TMP_DIR]/home/.databrickscfg config file)
11+
✓ auth_type: databricks-cli (from ./home/.databrickscfg config file)
1212
✓ rate_limit: [NUMID] (from DATABRICKS_RATE_LIMIT environment variable)

acceptance/cmd/auth/describe/u2m-plaintext-default/output.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Unable to authenticate: error getting token: cache: token not found
55
Token storage: plaintext, ~/.databricks/token-cache.json (from default)
66
-----
77
Current configuration:
8-
✓ host: https://u2m-profile.databricks.test (from [TEST_TMP_DIR]/home/.databrickscfg config file)
8+
✓ host: https://u2m-profile.databricks.test (from ./home/.databrickscfg config file)
99
✓ profile: u2m-profile (from --profile flag)
1010
✓ databricks_cli_path: [CLI]
11-
✓ auth_type: databricks-cli (from [TEST_TMP_DIR]/home/.databrickscfg config file)
11+
✓ auth_type: databricks-cli (from ./home/.databrickscfg config file)
1212
✓ rate_limit: [NUMID] (from DATABRICKS_RATE_LIMIT environment variable)

acceptance/cmd/auth/describe/u2m-plaintext-env/output.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Unable to authenticate: error getting token: cache: token not found
55
Token storage: plaintext, ~/.databricks/token-cache.json (from DATABRICKS_AUTH_STORAGE environment variable)
66
-----
77
Current configuration:
8-
✓ host: https://u2m-profile.databricks.test (from [TEST_TMP_DIR]/home/.databrickscfg config file)
8+
✓ host: https://u2m-profile.databricks.test (from ./home/.databrickscfg config file)
99
✓ profile: u2m-profile (from --profile flag)
1010
✓ databricks_cli_path: [CLI]
11-
✓ auth_type: databricks-cli (from [TEST_TMP_DIR]/home/.databrickscfg config file)
11+
✓ auth_type: databricks-cli (from ./home/.databrickscfg config file)
1212
✓ rate_limit: [NUMID] (from DATABRICKS_RATE_LIMIT environment variable)

acceptance/cmd/completion/output.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11

22
>>> [CLI] completion install --shell zsh --auto-approve
33
Databricks CLI completions installed for zsh.
4-
Restart your shell or run 'source [HOME]/.zshrc' to activate.
4+
Restart your shell or run 'source home/.zshrc' to activate.
55

66
Warning: zsh completions require the completion system to be initialized.
7-
Add the following to your [HOME]/.zshrc:
7+
Add the following to your home/.zshrc:
88
autoload -U compinit && compinit
99

1010
>>> [CLI] completion status --shell zsh
1111
Shell: zsh
12-
File: [HOME]/.zshrc
12+
File: home/.zshrc
1313
Status: installed
1414

1515
Warning: zsh completions require the completion system to be initialized.
16-
Add the following to your [HOME]/.zshrc:
16+
Add the following to your home/.zshrc:
1717
autoload -U compinit && compinit
1818

1919
>>> [CLI] completion install --shell zsh --auto-approve
20-
Databricks CLI completions are already installed for zsh in [HOME]/.zshrc.
20+
Databricks CLI completions are already installed for zsh in home/.zshrc.
2121

2222
Warning: zsh completions require the completion system to be initialized.
23-
Add the following to your [HOME]/.zshrc:
23+
Add the following to your home/.zshrc:
2424
autoload -U compinit && compinit
2525

2626
>>> [CLI] completion uninstall --shell zsh --auto-approve
27-
Databricks CLI completions removed for zsh from [HOME]/.zshrc.
27+
Databricks CLI completions removed for zsh from home/.zshrc.
2828

2929
>>> [CLI] completion status --shell zsh
3030
Shell: zsh
31-
File: [HOME]/.zshrc
31+
File: home/.zshrc
3232
Status: not installed
3333
# bash completion V2 for databricks -*- shell-script -*-
3434
#compdef databricks

acceptance/script.prepare

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -101,24 +101,11 @@ sethome() {
101101
local home="$1"
102102
mkdir -p "$home"
103103

104-
# Resolve to an absolute path so HOME (and USERPROFILE) keep pointing at
105-
# the same directory after the test cd's elsewhere. The SDK expands
106-
# `~/.databrickscfg` against $HOME at lookup time; with a relative path
107-
# the cfg silently disappears once the cwd changes, and helpers like
108-
# databrickscfg.GetConfiguredDefaultProfile return "" instead of
109-
# erroring.
110-
111104
# For macOS and Linux, use HOME.
112-
export HOME="$(cd "$home" && pwd)"
105+
export HOME="$home"
113106

114-
# For Windows, use USERPROFILE. On Git Bash (MSYS), plain `pwd` returns
115-
# Unix-style /c/... paths that the native Windows Go binary can't open;
116-
# `pwd -W` returns the mixed C:/... form instead.
117-
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" || "$OSTYPE" == "win32" ]]; then
118-
export USERPROFILE="$(cd "$home" && pwd -W)"
119-
else
120-
export USERPROFILE="$(cd "$home" && pwd)"
121-
fi
107+
# For Windows, use USERPROFILE.
108+
export USERPROFILE="$home"
122109
}
123110

124111
as-test-sp() {

0 commit comments

Comments
 (0)