Fix EOF error log when importing tarball files

Signed-off-by: Vitor Savian <vitor.savian@suse.com>
pull/10973/head
Vitor Savian 1 week ago
parent 352a2f8eaf
commit 3f36fe0fda

@ -50,6 +50,16 @@ func isFileSupported(path string) bool {
return false
}
func isTarball(path string) bool {
for _, ext := range tarfile.SupportedExtensions {
if strings.HasSuffix(path, ext) {
return true
}
}
return false
}
func (w *Watcher) HandleWatch(path string) error {
if err := w.watcher.Add(path); err != nil {
return errors.Wrap(err, fmt.Sprintf("failed to watch from %s directory: %v", path, err))
@ -129,6 +139,10 @@ func (w *Watcher) processNextEventForImages(ctx context.Context, cfg *config.Nod
return false
}
if isTarball(event.Name) {
time.Sleep(1 * time.Second)
}
if err := w.processImageEvent(ctx, event, cfg, client, imageClient); err != nil {
logrus.Errorf("Failed to process image event: %v", err)
}
@ -225,7 +239,6 @@ func (w *Watcher) processImageEvent(ctx context.Context, event fsnotify.Event, c
w.filesMap[event.Name] = info
logrus.Debugf("File added to watcher controller: %s", event.Name)
start := time.Now()
if err := preloadFile(ctx, cfg, client, imageClient, event.Name); err != nil {
logrus.Errorf("Error encountered while importing %s: %v", event.Name, err)

Loading…
Cancel
Save