Skip to content

Commit

Permalink
DUPLO-13529 use a tenant we know the user has access to
Browse files Browse the repository at this point in the history
  • Loading branch information
duplodavid committed Dec 21, 2023
1 parent 8e68907 commit c6a1087
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/duplo.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package internal

import (
"encoding/json"
"errors"
"fmt"
"log"
"os"
Expand Down Expand Up @@ -135,11 +136,16 @@ func PingDuploCreds(creds *DuploCredsOutput, host string) error {
return err
}

tenant, terr := client.GetTenantByNameForUser("default")
tenants, terr := client.ListTenantsForUser()
if terr != nil {
return err
return terr
}

if len(*tenants) == 0 {
return errors.New("PingDuploCreds: user has no tenants")
}

tenant := (*tenants)[0]
_, ferr := client.GetTenantFeatures(tenant.TenantID)
if ferr != nil {
return ferr
Expand Down

0 comments on commit c6a1087

Please sign in to comment.