diff --git a/pkg/cwhub/dataset.go b/pkg/cwhub/dataset.go index e73b5f9654b..b92a741b9c6 100644 --- a/pkg/cwhub/dataset.go +++ b/pkg/cwhub/dataset.go @@ -43,11 +43,6 @@ func downloadFile(url string, destPath string) error { os.Remove(tmpFileName) }() - // a check on stdout is used while scripting to know if the hub has been upgraded - // and a configuration reload is required - // TODO: use a better way to communicate this - fmt.Printf("updated %s\n", filepath.Base(destPath)) - // avoid reading the whole file in memory _, err = io.Copy(tmpFile, resp.Body) if err != nil { @@ -62,6 +57,11 @@ func downloadFile(url string, destPath string) error { return err } + // a check on stdout is used while scripting to know if the hub has been upgraded + // and a configuration reload is required + // TODO: use a better way to communicate this + fmt.Printf("updated %s\n", filepath.Base(destPath)) + if err = os.Rename(tmpFileName, destPath); err != nil { return err }