Skip to content

ssh setup: handle duplicate cluster names in the interactive cluster picker#5777

Open
sridhar-3009 wants to merge 1 commit into
databricks:mainfrom
sridhar-3009:fix/auth-login-duplicate-cluster-name-974
Open

ssh setup: handle duplicate cluster names in the interactive cluster picker#5777
sridhar-3009 wants to merge 1 commit into
databricks:mainfrom
sridhar-3009:fix/auth-login-duplicate-cluster-name-974

Conversation

@sridhar-3009

Copy link
Copy Markdown

Problem

The SSH setup command's interactive cluster picker called the SDK's
ClusterDetailsClusterNameToClusterIdMap, which builds a map[string]string
keyed by cluster display name. Databricks allows multiple clusters to share the
same name, so this call fails with:

Error: failed to load names for Clusters drop-down. Please manually specify
cluster argument. Original error: duplicate .ClusterName: <name>

The same underlying issue was originally reported against auth login --configure-cluster (#974) — the auth login path was fixed by switching to
AskForCluster (which uses ListAll directly), but the SSH setup path was
left using the broken SDK helper.

Fix

In experimental/ssh/internal/setup/setup.go, replaced the
ClusterDetailsClusterNameToClusterIdMap call with ListAll plus a new
buildClusterItems helper. The helper builds the picker list without any
name-based keying. When two or more clusters share a name, each entry gets
(<cluster-id>) appended so the user can distinguish them. Clusters with
unique names are displayed without modification.

Tests

Added four unit tests for buildClusterItems covering:

  • Two clusters with unique names — no suffix added
  • Two clusters with the same name — both get (id) appended
  • Three clusters with the same name — all three disambiguated
  • Mixed case: one unique name and two duplicates — only the duplicates get a suffix

Fixes #974

…picker

The SSH setup cluster picker called ClusterDetailsClusterNameToClusterIdMap
from the Databricks SDK to build a name→ID map for the interactive drop-down.
That SDK method fails with "duplicate .ClusterName: <name>" whenever two or
more clusters in the workspace share the same display name, which Databricks
permits.

Replace the SDK call with a direct ListAll call and a new buildClusterItems
helper that constructs the picker list without any keying by name. When two
clusters share a name, both entries are shown with " (<cluster-id>)" appended
so the user can tell them apart. Unique names are displayed unchanged.

Fixes databricks#974
@github-actions

Copy link
Copy Markdown
Contributor

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 5777
  • Commit SHA: cf90d1a5140800fb095655ac5f6522bf4ccf6988

Checks will be approved automatically on success.

@github-actions

Copy link
Copy Markdown
Contributor

Waiting for approval

Based on git history, these people are best suited to review:

  • @pietern -- recent work in experimental/ssh/internal/setup/
  • @ilia-db -- recent work in experimental/ssh/internal/setup/

Eligible reviewers: @andrewnester, @anton-107, @denik, @renaudhartert-db, @shreyas-goenka, @simonfaltum

Suggestions based on git history. See OWNERS for ownership rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant