Skip to content

Commit

Permalink
if we run into the issue with activation, print the diagnostics (#734)
Browse files Browse the repository at this point in the history
* if we run into the issue with activation, print the diagnostics

* update to fix linter

* fix
  • Loading branch information
meyerjrr authored Aug 15, 2024
1 parent 30fc54f commit fd96ec8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pkg/git/clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package git

import (
"bufio"
"fmt"
"errors"
"os/exec"
"strings"

Expand All @@ -23,7 +23,7 @@ func Clone(repoURL string, repoDirPath string) error {
scanner := bufio.NewScanner(stderr)
for scanner.Scan() {
if strings.Contains(strings.ToLower(scanner.Text()), "error") || strings.Contains(strings.ToLower(scanner.Text()), "fatal") {
return fmt.Errorf(scanner.Text())
return errors.New(scanner.Text())
}

clio.Info(scanner.Text())
Expand Down
4 changes: 2 additions & 2 deletions pkg/git/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package git

import (
"bufio"
"fmt"
"errors"
"os/exec"
"strings"

Expand All @@ -25,7 +25,7 @@ func Pull(repoDirPath string, shouldSilentLogs bool) error {
scanner := bufio.NewScanner(stderr)
for scanner.Scan() {
if strings.Contains(scanner.Text(), "error") || strings.Contains(scanner.Text(), "fatal") {
return fmt.Errorf(scanner.Text())
return errors.New(scanner.Text())
}

if shouldSilentLogs {
Expand Down
3 changes: 2 additions & 1 deletion pkg/granted/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ func installFishCompletions(c *cli.Context) error {
// Try to create a file
err := os.WriteFile(executableDir, []byte(combinedOutput), 0600)
if err != nil {
return fmt.Errorf("Something went wrong when saving fish autocompletions: " + err.Error())

return fmt.Errorf("something went wrong when saving fish autocompletions: %s", err.Error())
}
clio.Success("Fish autocompletions generated successfully")
clio.Info("To use these completions please run the executable:")
Expand Down
1 change: 1 addition & 0 deletions pkg/hook/accessrequesthook/accessrequesthook.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ func (h Hook) RetryNoEntitlementAccess(ctx context.Context, cfg *config.Context,
// if grant is approved but the change is unspecified then the user is not able to automatically activate
if g.Grant.Approved && g.Change == accessv1alpha1.GrantChange_GRANT_CHANGE_UNSPECIFIED && g.Grant.ProvisioningStatus != accessv1alpha1.ProvisioningStatus_PROVISIONING_STATUS_SUCCESSFUL {
clio.Infof("Request was approved but failed to activate, you might not have permission to activate. You can try and activate the access using the Common Fate web console. [%s elapsed]", elapsed)
printdiags.Print(res.Msg.Diagnostics, nil)
}

if !g.Grant.Approved {
Expand Down

0 comments on commit fd96ec8

Please sign in to comment.