check size of preload

pull/15256/head
Steven Powell 2022-10-31 13:36:22 -07:00
parent 1353c3cd35
commit f9ef43e7b5
1 changed files with 2 additions and 2 deletions

View File

@ -144,7 +144,7 @@ func PreloadExists(k8sVersion, containerRuntime, driverName string, forcePreload
// Omit remote check if tarball exists locally // Omit remote check if tarball exists locally
targetPath := TarballPath(k8sVersion, containerRuntime) targetPath := TarballPath(k8sVersion, containerRuntime)
if _, err := checkCache(targetPath); err == nil { if f, err := checkCache(targetPath); err == nil && f.Size() != 0 {
klog.Infof("Found local preload: %s", targetPath) klog.Infof("Found local preload: %s", targetPath)
setPreloadState(k8sVersion, containerRuntime, true) setPreloadState(k8sVersion, containerRuntime, true)
return true return true
@ -170,7 +170,7 @@ func Preload(k8sVersion, containerRuntime, driverName string) error {
return err return err
} }
if _, err := checkCache(targetPath); err == nil { if f, err := checkCache(targetPath); err == nil && f.Size() != 0 {
klog.Infof("Found %s in cache, skipping download", targetPath) klog.Infof("Found %s in cache, skipping download", targetPath)
return nil return nil
} }