You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2019/03/08 09:10:37 UTC

[camel-k] branch master updated: chore(lint): fix findings

This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/master by this push:
     new 2ee78bf  chore(lint): fix findings
2ee78bf is described below

commit 2ee78bf9d3c4486301e7ad3ac905e2c5e5f5e680
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Wed Mar 6 21:30:54 2019 +0100

    chore(lint): fix findings
---
 pkg/trait/gc.go                  |  1 -
 pkg/trait/knative_service.go     |  4 +---
 pkg/trait/knative_service_env.go | 10 ++++++++--
 pkg/trait/knative_service_vol.go |  4 +---
 pkg/util/kubernetes/resolver.go  |  1 +
 5 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/pkg/trait/gc.go b/pkg/trait/gc.go
index ce761db..191155b 100644
--- a/pkg/trait/gc.go
+++ b/pkg/trait/gc.go
@@ -22,7 +22,6 @@ import (
 	"fmt"
 	"strconv"
 
-
 	k8serrors "k8s.io/apimachinery/pkg/api/errors"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 
diff --git a/pkg/trait/knative_service.go b/pkg/trait/knative_service.go
index b8df091..afa9eea 100644
--- a/pkg/trait/knative_service.go
+++ b/pkg/trait/knative_service.go
@@ -202,9 +202,7 @@ func (t *knativeServiceTrait) getServiceFor(e *Environment) (*serving.Service, e
 	envvar.SetVal(environment, "AB_JOLOKIA_OFF", True)
 
 	if t.ConfigurationType == "volume" {
-		if err := t.bindToVolumes(e, &svc); err != nil {
-			return nil, err
-		}
+		t.bindToVolumes(e, &svc)
 	} else {
 		if err := t.bindToEnvVar(e, &svc); err != nil {
 			return nil, err
diff --git a/pkg/trait/knative_service_env.go b/pkg/trait/knative_service_env.go
index 04a181f..e481706 100644
--- a/pkg/trait/knative_service_env.go
+++ b/pkg/trait/knative_service_env.go
@@ -49,9 +49,12 @@ func (t *knativeServiceTrait) bindToEnvVar(e *Environment, service *serving.Serv
 			t.L.Errorf(err, "failed to lookup ConfigMap %s", cmName)
 		}
 		if cm != nil {
-			util.ExtractApplicationProperties(cm.Data, func(key string, val string) {
+			err = util.ExtractApplicationProperties(cm.Data, func(key string, val string) {
 				properties[key] = val
 			})
+			if err != nil {
+				t.L.Errorf(err, "failed to extract properties from ConfigMap %s", cmName)
+			}
 		}
 	})
 
@@ -61,9 +64,12 @@ func (t *knativeServiceTrait) bindToEnvVar(e *Environment, service *serving.Serv
 			t.L.Errorf(err, "failed to lookup Secret %s", secretName)
 		}
 		if cm != nil {
-			util.ExtractEncodedApplicationProperties(cm.Data, func(key string, val string) {
+			err = util.ExtractEncodedApplicationProperties(cm.Data, func(key string, val string) {
 				properties[key] = val
 			})
+			if err != nil {
+				t.L.Errorf(err, "failed to extract properties from Secret %s", secretName)
+			}
 		}
 	})
 
diff --git a/pkg/trait/knative_service_vol.go b/pkg/trait/knative_service_vol.go
index 9bf1ee7..efe058d 100644
--- a/pkg/trait/knative_service_vol.go
+++ b/pkg/trait/knative_service_vol.go
@@ -24,7 +24,7 @@ import (
 	serving "github.com/knative/serving/pkg/apis/serving/v1alpha1"
 )
 
-func (t *knativeServiceTrait) bindToVolumes(e *Environment, service *serving.Service) error {
+func (t *knativeServiceTrait) bindToVolumes(e *Environment, service *serving.Service) {
 	e.ConfigureVolumesAndMounts(
 		t.deployer.ContainerImage,
 		&service.Spec.RunLatest.Configuration.RevisionTemplate.Spec.Volumes,
@@ -38,6 +38,4 @@ func (t *knativeServiceTrait) bindToVolumes(e *Environment, service *serving.Ser
 	envvar.SetVal(environment, "CAMEL_K_ROUTES", strings.Join(paths, ","))
 	envvar.SetVal(environment, "CAMEL_K_CONF", "/etc/camel/conf/application.properties")
 	envvar.SetVal(environment, "CAMEL_K_CONF_D", "/etc/camel/conf.d")
-
-	return nil
 }
diff --git a/pkg/util/kubernetes/resolver.go b/pkg/util/kubernetes/resolver.go
index 5330e58..d2ad8fc 100644
--- a/pkg/util/kubernetes/resolver.go
+++ b/pkg/util/kubernetes/resolver.go
@@ -99,6 +99,7 @@ func ResolveIntegrationSources(context context.Context, client client.Client, in
 }
 
 // ResolveIntegrationResources --
+// nolint: lll
 func ResolveIntegrationResources(context context.Context, client client.Client, integration *v1alpha1.Integration, resources *Collection) ([]v1alpha1.ResourceSpec, error) {
 	if integration == nil {
 		return nil, nil