You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/11/23 16:37:03 UTC

(camel-k) 01/01: chore(trait): run mount only when necessary

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

pcongiusti pushed a commit to branch squakez-patch-1
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 68d18f515794b9c26dc8ba283ffee98f59d94885
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Thu Nov 23 17:36:56 2023 +0100

    chore(trait): run mount only when necessary
---
 pkg/trait/mount.go | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/pkg/trait/mount.go b/pkg/trait/mount.go
index 35324a633..0a08eb798 100644
--- a/pkg/trait/mount.go
+++ b/pkg/trait/mount.go
@@ -62,8 +62,11 @@ func (t *mountTrait) Configure(e *Environment) (bool, *TraitCondition, error) {
 		}
 	}
 
-	// mount trait needs always to be executed as it will process the sources
-	return true, nil, nil
+	// mount trait needs to be executed only when it has sources attached or any trait configuration
+	return len(e.Integration.Sources()) > 0 ||
+		len(t.Configs) > 0 ||
+		len(t.Resources) > 0 ||
+		len(t.Volumes) > 0, nil, nil
 }
 
 func (t *mountTrait) Apply(e *Environment) error {