Skip to content

Commit

Permalink
Bail if fail to mkdir or download sos
Browse files Browse the repository at this point in the history
  • Loading branch information
dosaboy committed Oct 9, 2023
1 parent 13b1ed7 commit c8f173f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/monitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,15 @@ func (m *Monitor) PollNewFiles(ctx *context.Context, duration time.Duration) {
if _, err := os.Stat(basePath); os.IsNotExist(err) {
log.Debugf("Temporary base path '%s' doesn't exist - creating", basePath)
if err = os.MkdirAll(basePath, 0755); err != nil {
log.Errorf("Cannot create temporary base path: %s", err.Error())
log.Errorf("Failed to create temporary base path: %s - skipping", err.Error())
continue
}
}
log.Debugf("Using temporary base path: %s", basePath)
fileEntry, err := m.FilesClient.Download(&file, basePath)
if err != nil {
log.Errorf("Failed to download %s: %s", file.Path, err)
log.Errorf("Failed to download %s: %s - skipping", file.Path, err)
continue
}
log.Infof("Downloaded %s", fileEntry.Path)

Expand Down

0 comments on commit c8f173f

Please sign in to comment.