diff --git a/src/pkg/layout/component.go b/src/pkg/layout/component.go index 7698009b57..e82409aa68 100644 --- a/src/pkg/layout/component.go +++ b/src/pkg/layout/component.go @@ -7,11 +7,12 @@ package layout import ( "context" "fmt" - "github.com/zarf-dev/zarf/src/pkg/logger" "io/fs" "os" "path/filepath" + "github.com/zarf-dev/zarf/src/pkg/logger" + "github.com/defenseunicorns/pkg/helpers/v2" "github.com/mholt/archiver/v3" "github.com/zarf-dev/zarf/src/api/v1alpha1" diff --git a/src/pkg/layout/package.go b/src/pkg/layout/package.go index 994679d916..ac2f4d875d 100644 --- a/src/pkg/layout/package.go +++ b/src/pkg/layout/package.go @@ -8,12 +8,13 @@ import ( "context" "errors" "fmt" - "github.com/zarf-dev/zarf/src/pkg/logger" "os" "path/filepath" "slices" "strings" + "github.com/zarf-dev/zarf/src/pkg/logger" + "github.com/Masterminds/semver/v3" "github.com/defenseunicorns/pkg/helpers/v2" "github.com/google/go-containerregistry/pkg/crane" diff --git a/src/pkg/utils/network.go b/src/pkg/utils/network.go index 8bfd2f1838..016cf3d255 100644 --- a/src/pkg/utils/network.go +++ b/src/pkg/utils/network.go @@ -8,7 +8,6 @@ import ( "context" "errors" "fmt" - "github.com/zarf-dev/zarf/src/pkg/logger" "io" "net/http" "net/url" @@ -16,9 +15,10 @@ import ( "path/filepath" "strings" + "github.com/zarf-dev/zarf/src/pkg/logger" + "github.com/defenseunicorns/pkg/helpers/v2" "github.com/zarf-dev/zarf/src/config/lang" - "github.com/zarf-dev/zarf/src/pkg/message" ) func parseChecksum(src string) (string, string, error) { @@ -96,36 +96,6 @@ func DownloadToFile(ctx context.Context, src, dst, cosignKeyPath string) (err er return nil } -func httpGetFileProgress(url string, destinationFile *os.File) (err error) { - // Get the data - resp, err := http.Get(url) - if err != nil { - return fmt.Errorf("unable to download the file %s", url) - } - defer func() { - err2 := resp.Body.Close() - err = errors.Join(err, err2) - }() - - // Check server response - if resp.StatusCode != http.StatusOK { - return fmt.Errorf("bad HTTP status: %s", resp.Status) - } - - // Writer the body to file - title := fmt.Sprintf("Downloading %s", filepath.Base(url)) - progressBar := message.NewProgressBar(resp.ContentLength, title) - - if _, err = io.Copy(destinationFile, io.TeeReader(resp.Body, progressBar)); err != nil { - progressBar.Failf("Unable to save the file %s: %s", destinationFile.Name(), err.Error()) - return err - } - - title = fmt.Sprintf("Downloaded %s", url) - progressBar.Successf("%s", title) - return nil -} - func httpGetFile(ctx context.Context, url string, destinationFile *os.File) (err error) { l := logger.From(ctx) l.Info("download start", "url", url)