Skip to content

Commit

Permalink
If reauth is required, show the full command-line path of the binary (#…
Browse files Browse the repository at this point in the history
…47)

The error message that gets printed out tells me to login again.
However, it doesn't show the full path of the binary that was used to
run the credential helper.
  • Loading branch information
rogerhu authored Sep 3, 2024
1 parent cb34acd commit bab0014
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/autherr/coded_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ package autherr
import (
"errors"
"fmt"
"os"
"path/filepath"
)

const (
Expand Down Expand Up @@ -56,6 +58,7 @@ func CodedErrorf(code int, format string, args ...any) error {
func ReauthRequired(cluster string) error {
const reauthMessage = "Missing/invalid/expired credentials for cluster: %s\n" +
"Please refresh credentials by running:\n\n\t" +
"engflow_auth login %s\n"
return CodedErrorf(CodeReauthRequired, reauthMessage, cluster, cluster)
"%s login %s\n"
cmdPath := filepath.ToSlash(os.Args[0])
return CodedErrorf(CodeReauthRequired, reauthMessage, cluster, cmdPath, cluster)
}

0 comments on commit bab0014

Please sign in to comment.