Skip to content

Commit

Permalink
Merge pull request #91 from dosaboy:monitor-bail-on-fail
Browse files Browse the repository at this point in the history
Bail if fail to mkdir or download sos
  • Loading branch information
nicolasbock committed Oct 9, 2023
2 parents 13b1ed7 + c8f173f commit dd43bbc
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 dd43bbc

Please sign in to comment.