Skip to content

update tsh db env/config ux#30530

Merged
GavinFrazar merged 1 commit intomasterfrom
gavinfrazar/fix-tsh-db-env-config
Aug 16, 2023
Merged

update tsh db env/config ux#30530
GavinFrazar merged 1 commit intomasterfrom
gavinfrazar/fix-tsh-db-env-config

Conversation

@GavinFrazar
Copy link
Copy Markdown
Contributor

stacked on related change for tsh db connect: #30527

This PR changes tsh db env and tsh db config such that when a given db name doesn't match any active cert fully,
it calls the ListDatabases API to check if any inactive databases fully match.

Example UX Diff:

Suppose we have two databases, one a prefix of the other and not logged into:

$ tsh db ls
Name                                      Description                   Allowed Users Labels Connect                  
----------------------------------------- ----------------------------- ------------- ------ ------------------------ 
postgres                                  Example dyn database resource [* alice]                                     
> postgres2 (user: alice, db: postgres... Example dyn database resource [* alice]            tsh db connect postgres2 

Prior behavior: (Note that postgres-2 is used, because "postgres" is a prefix of its name)

$ tsh db env postgres
export PGSSLROOTCERT=/Users/gavin/.tsh/keys/mars.local.gd/cas/mars.local.gd.pem
export PGSSLCERT=/Users/gavin/.tsh/keys/mars.local.gd/martian-db/mars.local.gd/postgres2-x509.pem
export PGDATABASE=postgres
export PGPORT=6543
export PGSSLMODE=verify-full
export PGSSLKEY=/Users/gavin/.tsh/keys/mars.local.gd/martian
export PGUSER=alice
export PGGSSENCMODE=disable
export PGHOST=postgres.mars.local.gd

New behavior:

$ tsh db env postgres
ERROR: not logged into database "postgres"

@GavinFrazar GavinFrazar added ux tsh tsh - Teleport's command line tool for logging into nodes running Teleport. backport/branch/v13 labels Aug 16, 2023
@GavinFrazar GavinFrazar requested a review from smallinsky August 16, 2023 01:11
@GavinFrazar GavinFrazar requested a review from greedy52 August 16, 2023 01:20
Base automatically changed from gavinfrazar/fix-tsh-db-connect-prefix to master August 16, 2023 16:27
* when a given db name doesn't match any active cert fully,
  call ListDatabases API and check if any inactive databases fully match
@GavinFrazar GavinFrazar added this pull request to the merge queue Aug 16, 2023
@GavinFrazar GavinFrazar force-pushed the gavinfrazar/fix-tsh-db-env-config branch from 7cd2a4b to 45bcbf5 Compare August 16, 2023 17:15
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 16, 2023
@GavinFrazar GavinFrazar added this pull request to the merge queue Aug 16, 2023
Merged via the queue into master with commit 31e0942 Aug 16, 2023
@GavinFrazar GavinFrazar deleted the gavinfrazar/fix-tsh-db-env-config branch August 16, 2023 18:07
@public-teleport-github-review-bot
Copy link
Copy Markdown

@GavinFrazar See the table below for backport results.

Branch Result
branch/v13 Create PR

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

Labels

size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport. ux

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants