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

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


The following commit(s) were added to refs/heads/main by this push:
     new 7b8179a9c chore(trait): run mount only when necessary
7b8179a9c is described below

commit 7b8179a9c639be55656d74b3485f5750879c2092
Author: Pasquale Congiusti <[email protected]>
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 {

Reply via email to