From bdb2e154a12102ae749072f4d9cf95baf7f3bbf7 Mon Sep 17 00:00:00 2001 From: Joshua Gilman Date: Thu, 5 Dec 2024 20:18:06 -0800 Subject: [PATCH] fix(cli): fixes incorrect writing of bundle files (#106) --- cli/pkg/deployment/gitops.go | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/cli/pkg/deployment/gitops.go b/cli/pkg/deployment/gitops.go index 15c2ab07..9aff6455 100644 --- a/cli/pkg/deployment/gitops.go +++ b/cli/pkg/deployment/gitops.go @@ -93,22 +93,9 @@ func (g *GitopsDeployer) Deploy() error { } g.logger.Info("Writing bundle to filesystem", "path", bundlePath) - exists, err = fileExists(g.fs, bundlePath) + bundleFile, err := g.fs.Create(bundlePath) if err != nil { - return fmt.Errorf("could not check if bundle exists: %w", err) - } - - var bundleFile billy.File - if exists { - bundleFile, err = g.fs.OpenFile(bundlePath, os.O_RDWR, os.ModePerm) - if err != nil { - return fmt.Errorf("could not open bundle file: %w", err) - } - } else { - bundleFile, err = g.fs.Create(bundlePath) - if err != nil { - return fmt.Errorf("could not create bundle file: %w", err) - } + return fmt.Errorf("could not create bundle file: %w", err) } _, err = bundleFile.Write(bundle)