KuthumiPepple commented on a change in pull request #3153:
URL: https://github.com/apache/camel-k/pull/3153#discussion_r839031028



##########
File path: pkg/cmd/run_help.go
##########
@@ -43,20 +44,20 @@ func hashFrom(contents ...[]byte) string {
        return fmt.Sprintf("%x", hash.Sum(nil))
 }
 
-func parseConfigAndGenCm(ctx context.Context, c client.Client, config 
*resource.Config, integration *v1.Integration, enableCompression bool) 
(*corev1.ConfigMap, error) {
+func parseConfigAndGenCm(ctx context.Context, cmd *cobra.Command, c 
client.Client, config *resource.Config, integration *v1.Integration, 
enableCompression bool) (*corev1.ConfigMap, error) {
        switch config.StorageType() {
        case resource.StorageTypeConfigmap:
                cm := kubernetes.LookupConfigmap(ctx, c, integration.Namespace, 
config.Name())
                if cm == nil {
-                       fmt.Printf("Warn: %s Configmap not found in %s 
namespace, make sure to provide it before the Integration can run\n",
+                       fmt.Fprintf(cmd.ErrOrStderr(), "Warn: %s Configmap not 
found in %s namespace, make sure to provide it before the Integration can 
run\n",
                                config.Name(), integration.Namespace)
                } else if config.ContentType() != resource.ContentTypeData && 
cm.BinaryData != nil {
                        return nil, fmt.Errorf("you cannot provide a binary 
config, use a text file instead")
                }
        case resource.StorageTypeSecret:
                secret := kubernetes.LookupSecret(ctx, c, 
integration.Namespace, config.Name())
                if secret == nil {
-                       fmt.Printf("Warn: %s Secret not found in %s namespace, 
make sure to provide it before the Integration can run\n",
+                       fmt.Fprintf(cmd.ErrOrStderr(), "Warn: %s Secret not 
found in %s namespace, make sure to provide it before the Integration can 
run\n",

Review comment:
       Done

##########
File path: pkg/cmd/uninstall.go
##########
@@ -186,21 +186,21 @@ func (o *uninstallCmdOptions) uninstallOperator(ctx 
context.Context, c client.Cl
        return nil
 }
 
-func (o *uninstallCmdOptions) uninstallClusterWideResources(ctx 
context.Context, c client.Client, namespace string) error {
+func (o *uninstallCmdOptions) uninstallClusterWideResources(cmd 
*cobra.Command, ctx context.Context, c client.Client, namespace string) error {
        if !o.SkipCrd || o.UninstallAll {
                if err := o.uninstallCrd(ctx, c); err != nil {
                        if k8serrors.IsForbidden(err) {
-                               return createActionNotAuthorizedError()
+                               return createActionNotAuthorizedError(cmd)
                        }
                        return err
                }
-               fmt.Printf("Camel K Custom Resource Definitions removed from 
cluster\n")
+               fmt.Fprintf(cmd.OutOrStdout(), "Camel K Custom Resource 
Definitions removed from cluster\n")

Review comment:
       Done

##########
File path: pkg/cmd/uninstall.go
##########
@@ -209,71 +209,71 @@ func (o *uninstallCmdOptions) 
uninstallClusterWideResources(ctx context.Context,
        if !o.SkipClusterRoleBindings || o.UninstallAll {
                if err := o.uninstallClusterRoleBindings(ctx, c); err != nil {
                        if k8serrors.IsForbidden(err) {
-                               return createActionNotAuthorizedError()
+                               return createActionNotAuthorizedError(cmd)
                        }
                        return err
                }
-               fmt.Printf("Camel K Cluster Role Bindings removed from 
cluster\n")
+               fmt.Fprintf(cmd.OutOrStdout(), "Camel K Cluster Role Bindings 
removed from cluster\n")
        }
 
        if !o.SkipClusterRoles || o.UninstallAll {
                if err := o.uninstallClusterRoles(ctx, c); err != nil {
                        if k8serrors.IsForbidden(err) {
-                               return createActionNotAuthorizedError()
+                               return createActionNotAuthorizedError(cmd)
                        }
                        return err
                }
-               fmt.Printf("Camel K Cluster Roles removed from cluster\n")
+               fmt.Fprintf(cmd.OutOrStdout(), "Camel K Cluster Roles removed 
from cluster\n")
        }
 
        return nil
 }
 
-func (o *uninstallCmdOptions) uninstallNamespaceRoles(ctx context.Context, c 
client.Client) error {
+func (o *uninstallCmdOptions) uninstallNamespaceRoles(cmd *cobra.Command, ctx 
context.Context, c client.Client) error {
        if !o.SkipRoleBindings {
                if err := o.uninstallRoleBindings(ctx, c); err != nil {
                        return err
                }
-               fmt.Printf("Camel K Role Bindings removed from namespace %s\n", 
o.Namespace)
+               fmt.Fprintf(cmd.OutOrStdout(), "Camel K Role Bindings removed 
from namespace %s\n", o.Namespace)

Review comment:
       Done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to