You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2022/03/03 12:04:58 UTC

[camel-k] branch release-1.8.x updated: fix: The error handler trait should update status dependencies

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

astefanutti pushed a commit to branch release-1.8.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/release-1.8.x by this push:
     new dd53787  fix: The error handler trait should update status dependencies
dd53787 is described below

commit dd53787713b59a626bf425eeb7ece8fcce5e3fa7
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Tue Mar 1 19:00:04 2022 +0100

    fix: The error handler trait should update status dependencies
---
 pkg/trait/error_handler.go      | 5 +++--
 pkg/trait/error_handler_test.go | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/pkg/trait/error_handler.go b/pkg/trait/error_handler.go
index f11d107..590f737 100644
--- a/pkg/trait/error_handler.go
+++ b/pkg/trait/error_handler.go
@@ -25,6 +25,7 @@ import (
 
 	v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
 	"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
+	"github.com/apache/camel-k/pkg/util"
 )
 
 // The error-handler is a platform trait used to inject Error Handler source into the integration runtime.
@@ -82,10 +83,10 @@ func (t *errorHandlerTrait) Apply(e *Environment) error {
 func (t *errorHandlerTrait) addErrorHandlerDependencies(e *Environment, uri string) {
 	candidateComp, scheme := e.CamelCatalog.DecodeComponent(uri)
 	if candidateComp != nil {
-		e.Integration.Spec.AddDependency(candidateComp.GetDependencyID())
+		util.StringSliceUniqueAdd(&e.Integration.Status.Dependencies, candidateComp.GetDependencyID())
 		if scheme != nil {
 			for _, dep := range candidateComp.GetProducerDependencyIDs(scheme.ID) {
-				e.Integration.Spec.AddDependency(dep)
+				util.StringSliceUniqueAdd(&e.Integration.Status.Dependencies, dep)
 			}
 		}
 	}
diff --git a/pkg/trait/error_handler_test.go b/pkg/trait/error_handler_test.go
index c77d1ba..b582773 100644
--- a/pkg/trait/error_handler_test.go
+++ b/pkg/trait/error_handler_test.go
@@ -89,5 +89,5 @@ func TestErrorHandlerApplyDependency(t *testing.T) {
 	assert.True(t, enabled)
 	err = trait.Apply(e)
 	assert.Nil(t, err)
-	assert.Equal(t, "camel:log", e.Integration.Spec.Dependencies[0])
+	assert.Equal(t, "camel:log", e.Integration.Status.Dependencies[0])
 }