This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/main by this push:
new 1023aaf38 fix: don't log forbidden warning
1023aaf38 is described below
commit 1023aaf3825330fbf36b0c1aa431ebf062c7e324
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Thu Feb 2 15:19:40 2023 +0100
fix: don't log forbidden warning
Closes #3996
---
pkg/cmd/bind.go | 2 +-
pkg/cmd/run.go | 2 +-
pkg/cmd/util.go | 6 ++----
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/pkg/cmd/bind.go b/pkg/cmd/bind.go
index 06150e61f..6db6c6cd8 100644
--- a/pkg/cmd/bind.go
+++ b/pkg/cmd/bind.go
@@ -238,7 +238,7 @@ func (o *bindCmdOptions) run(cmd *cobra.Command, args
[]string) error {
}
if !isOfflineCommand(cmd) && o.OperatorID != "" {
- if err := verifyOperatorID(o.Context, client, o.OperatorID,
cmd.OutOrStdout()); err != nil {
+ if err := verifyOperatorID(o.Context, client, o.OperatorID);
err != nil {
if o.Force {
o.PrintfVerboseErrf(cmd, "%s, use --force
option or make sure to use a proper operator id", err.Error())
} else {
diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go
index 834eaab31..72624c28c 100644
--- a/pkg/cmd/run.go
+++ b/pkg/cmd/run.go
@@ -624,7 +624,7 @@ func (o *runCmdOptions) applyAnnotations(cmd
*cobra.Command, c client.Client, it
}
if !isOfflineCommand(cmd) && o.OperatorID != "" {
- if err := verifyOperatorID(o.Context, c, o.OperatorID,
cmd.OutOrStdout()); err != nil {
+ if err := verifyOperatorID(o.Context, c, o.OperatorID); err !=
nil {
if o.Force {
o.PrintfVerboseErrf(cmd, "%s, use --force
option or make sure to use a proper operator id", err.Error())
} else {
diff --git a/pkg/cmd/util.go b/pkg/cmd/util.go
index 1736037f2..537bcc1b2 100644
--- a/pkg/cmd/util.go
+++ b/pkg/cmd/util.go
@@ -22,7 +22,6 @@ import (
"encoding/csv"
"encoding/json"
"fmt"
- "io"
"log"
"reflect"
"strings"
@@ -241,11 +240,10 @@ func fieldByMapstructureTagName(target reflect.Value,
tagName string) (reflect.S
return reflect.StructField{}, false
}
-func verifyOperatorID(ctx context.Context, client client.Client, operatorID
string, out io.Writer) error {
+func verifyOperatorID(ctx context.Context, client client.Client, operatorID
string) error {
if pl, err := platformutil.LookupForPlatformName(ctx, client,
operatorID); err != nil {
if k8serrors.IsForbidden(err) {
- _, printErr := fmt.Fprintf(out, "Unable to verify
existence of operator id [%s] due to lack of user privileges\n", operatorID)
- return printErr
+ return nil
}
return err