From c98c791f60482f47592ffc026440f0b059dabd1b Mon Sep 17 00:00:00 2001 From: Dimitris Karakasilis Date: Mon, 20 Nov 2023 13:54:05 +0200 Subject: [PATCH] Call `exec.Command` properly, splitting the cmd and args This was failing but wasn't visible because it needs `fail_on_bundles_errors: true` to be set in the Kairos config. We need to find whether we need a new test or an existing one can be adapted to catch this. Signed-off-by: Dimitris Karakasilis --- internal/agent/hooks/bundles.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/agent/hooks/bundles.go b/internal/agent/hooks/bundles.go index a8ab45e..7f08676 100644 --- a/internal/agent/hooks/bundles.go +++ b/internal/agent/hooks/bundles.go @@ -1,13 +1,14 @@ package hook import ( + "os" + "os/exec" + "syscall" + config "github.com/kairos-io/kairos-agent/v2/pkg/config" v1 "github.com/kairos-io/kairos-agent/v2/pkg/types/v1" "github.com/kairos-io/kairos-sdk/bundles" "github.com/kairos-io/kairos-sdk/machine" - "os" - "os/exec" - "syscall" ) // BundlePostInstall install bundles just after installation @@ -36,7 +37,8 @@ func (b BundlePostInstall) Run(c config.Config, _ v1.Spec) error { if c.FailOnBundleErrors && err != nil { return err } - cmd := exec.Command("rsync -aqAX /var/lib/extensions /usr/local/.state/var-lib-extensions.bind") + + cmd := exec.Command("rsync", "-aqAX", "/var/lib/extensions", "/usr/local/.state/var-lib-extensions.bind") _, err = cmd.CombinedOutput() if c.FailOnBundleErrors && err != nil { return err