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 2020/03/02 11:02:11 UTC

[camel-k] 01/02: Catalog generation does not take into account the runtime provider to determine the catalog name #1312

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

commit 4daad1f9dea291a0797debb44d85806ca6b356f8
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Fri Feb 28 18:09:02 2020 +0100

    Catalog generation does not take into account the runtime provider to determine the catalog name #1312
---
 pkg/trait/camel.go | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/pkg/trait/camel.go b/pkg/trait/camel.go
index a28e418..b532c07 100644
--- a/pkg/trait/camel.go
+++ b/pkg/trait/camel.go
@@ -23,8 +23,6 @@ import (
 
 	"github.com/pkg/errors"
 
-	k8serrors "k8s.io/apimachinery/pkg/api/errors"
-
 	v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
 	"github.com/apache/camel-k/pkg/util/camel"
 	"github.com/apache/camel-k/pkg/util/maven"
@@ -109,7 +107,7 @@ func (t *camelTrait) loadOrCreateCatalog(e *Environment, runtimeVersion string)
 			}
 
 			// sanitize catalog name
-			catalogName := "camel-catalog-" + strings.ToLower(runtimeVersion) + "-main"
+			catalogName := "camel-catalog-" + strings.ToLower(runtimeVersion) + "-" + string(runtime.Provider)
 
 			cx := v1.NewCamelCatalogWithSpecs(ns, catalogName, catalog.CamelCatalogSpec)
 			cx.Labels = make(map[string]string)
@@ -119,8 +117,11 @@ func (t *camelTrait) loadOrCreateCatalog(e *Environment, runtimeVersion string)
 			cx.Labels["camel.apache.org/catalog.generated"] = True
 
 			err = e.Client.Create(e.C, &cx)
-			if err != nil && !k8serrors.IsAlreadyExists(err) {
-				return err
+			if err != nil {
+				return errors.Wrapf(err, "unable to create catalog runtime=%s, provider=%s, name=%s",
+					runtime.Version,
+					runtime.Provider,
+					catalogName)
 			}
 		}
 	}