Skip to content

Commit

Permalink
DATA-3385 Fix ConfigureDatabaseUser flow (#4567)
Browse files Browse the repository at this point in the history
  • Loading branch information
vijayvuyyuru authored Nov 19, 2024
1 parent ee52727 commit 20a332d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cli/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ const (
serverErrorMessage = "received error from server"

viamCaptureDotSubdir = "/.viam/capture/"

noExistingADFErrCode = "NotFound"
)

// DataExportAction is the corresponding action for 'data export'.
Expand Down Expand Up @@ -929,11 +931,13 @@ func DataConfigureDatabaseUserConfirmation(c *cli.Context) error {
}

res, err := client.dataGetDatabaseConnection(c.String(generalFlagOrgID))
if err != nil {
// if the error is adf doesn't exist for org yet, continue and skip HasDatabaseUser check
if err != nil && !strings.Contains(err.Error(), noExistingADFErrCode) {
return err
}

if res.HasDatabaseUser {
// skip this check if we don't have an existing ADF instance
if err == nil && res.HasDatabaseUser {
yellow := "\033[1;33m%s\033[0m"
printf(c.App.Writer, yellow, "WARNING!!\n")
printf(c.App.Writer, yellow, "You or someone else in your organization have already created a user.\n")
Expand Down

0 comments on commit 20a332d

Please sign in to comment.