This is an automated email from the ASF dual-hosted git repository. nferraro pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 0572cd206e41933bdefedcaf2f42bf8e5a7b6631 Author: lburgazzoli <lburgazz...@gmail.com> AuthorDate: Thu Dec 20 22:17:34 2018 +0100 chore(lint): fix findings --- pkg/builder/builder_steps.go | 4 +++- pkg/client/cmd/install.go | 4 +++- pkg/install/operator.go | 1 + pkg/trait/dependencies.go | 7 ++++--- pkg/util/kubernetes/collection.go | 3 ++- pkg/util/kubernetes/loader.go | 1 + pkg/util/maven/maven_project.go | 7 ++++--- 7 files changed, 18 insertions(+), 9 deletions(-) diff --git a/pkg/builder/builder_steps.go b/pkg/builder/builder_steps.go index e55f8cc..ffe7137 100644 --- a/pkg/builder/builder_steps.go +++ b/pkg/builder/builder_steps.go @@ -250,7 +250,9 @@ func ListPublishedImages(context *Context) ([]PublishedImage, error) { return nil, err } images := make([]PublishedImage, 0) - for _, ctx := range list.Items { + for _, item := range list.Items { + ctx := item + if ctx.Status.Phase != v1alpha1.IntegrationContextPhaseReady || ctx.Labels == nil { continue } diff --git a/pkg/client/cmd/install.go b/pkg/client/cmd/install.go index 142f521..6abe4bc 100644 --- a/pkg/client/cmd/install.go +++ b/pkg/client/cmd/install.go @@ -83,7 +83,9 @@ func (o *installCmdOptions) install(cmd *cobra.Command, args []string) error { err := install.SetupClusterwideResourcesOrCollect(collection) if err != nil && k8serrors.IsForbidden(err) { fmt.Println("Current user is not authorized to create cluster-wide objects like custom resource definitions or cluster roles: ", err) - return errors.New("please login as cluster-admin and execute \"kamel install --cluster-setup\" to install cluster-wide resources (one-time operation)") + + meg := `please login as cluster-admin and execute "kamel install --cluster-setup" to install cluster-wide resources (one-time operation)` + return errors.New(meg) } else if err != nil { return err } diff --git a/pkg/install/operator.go b/pkg/install/operator.go index 3088df3..a35c344 100644 --- a/pkg/install/operator.go +++ b/pkg/install/operator.go @@ -96,6 +96,7 @@ func Platform(namespace string, registry string, organization string, pushSecret } // PlatformOrCollect -- +// nolint: lll func PlatformOrCollect(namespace string, registry string, organization string, pushSecret string, collection *kubernetes.Collection) (*v1alpha1.IntegrationPlatform, error) { if err := waitForPlatformCRDAvailable(namespace, 25*time.Second); err != nil { return nil, err diff --git a/pkg/trait/dependencies.go b/pkg/trait/dependencies.go index 3593dde..eddee8b 100644 --- a/pkg/trait/dependencies.go +++ b/pkg/trait/dependencies.go @@ -49,11 +49,12 @@ func (t *dependenciesTrait) Apply(e *Environment) error { for _, s := range e.Integration.Spec.Sources { meta := metadata.Extract(s) - if meta.Language == v1alpha1.LanguageGroovy { + switch meta.Language { + case v1alpha1.LanguageGroovy: util.StringSliceUniqueAdd(&e.Integration.Spec.Dependencies, "runtime:groovy") - } else if meta.Language == v1alpha1.LanguageKotlin { + case v1alpha1.LanguageKotlin: util.StringSliceUniqueAdd(&e.Integration.Spec.Dependencies, "runtime:kotlin") - } else if meta.Language == v1alpha1.LanguageYamlFlow { + case v1alpha1.LanguageYamlFlow: util.StringSliceUniqueAdd(&e.Integration.Spec.Dependencies, "runtime:yaml") } diff --git a/pkg/util/kubernetes/collection.go b/pkg/util/kubernetes/collection.go index 54b340b..6d7e1ce 100644 --- a/pkg/util/kubernetes/collection.go +++ b/pkg/util/kubernetes/collection.go @@ -23,6 +23,7 @@ import ( appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" ) @@ -52,7 +53,7 @@ func (c *Collection) Items() []runtime.Object { func (c *Collection) AsKubernetesList() *corev1.List { lst := corev1.List{ TypeMeta: metav1.TypeMeta{ - Kind: "List", + Kind: "List", APIVersion: "v1", }, Items: make([]runtime.RawExtension, 0, len(c.items)), diff --git a/pkg/util/kubernetes/loader.go b/pkg/util/kubernetes/loader.go index cd830da..19085f1 100644 --- a/pkg/util/kubernetes/loader.go +++ b/pkg/util/kubernetes/loader.go @@ -19,6 +19,7 @@ package kubernetes import ( "encoding/json" + "github.com/operator-framework/operator-sdk/pkg/util/k8sutil" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" diff --git a/pkg/util/maven/maven_project.go b/pkg/util/maven/maven_project.go index 925d6e5..e965677 100644 --- a/pkg/util/maven/maven_project.go +++ b/pkg/util/maven/maven_project.go @@ -151,11 +151,12 @@ func NewRepository(repo string) Repository { r.URL = repo[:idx] for _, attribute := range strings.Split(repo[idx+1:], "@") { - if attribute == "snapshots" { + switch { + case attribute == "snapshots": r.Snapshots.Enabled = true - } else if attribute == "noreleases" { + case attribute == "noreleases": r.Releases.Enabled = false - } else if strings.HasPrefix(attribute, "id=") { + case strings.HasPrefix(attribute, "id="): r.ID = attribute[3:] } }