Skip to content

Commit

Permalink
Fix failures when using npipe monitoring endpoints (#1371)
Browse files Browse the repository at this point in the history
  • Loading branch information
michalpristas authored Sep 29, 2022
1 parent 4d7fae9 commit e184051
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/pkg/core/monitoring/beats/sidecar_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ func (b *SidecarMonitor) EnrichArgs(spec program.Spec, pipelineID string, args [
func (b *SidecarMonitor) Cleanup(spec program.Spec, pipelineID string) error {
endpoint := MonitoringEndpoint(spec, b.operatingSystem, pipelineID, true)
drop := monitoringDrop(endpoint)
if drop == "" {
// not exposed using sockets
return nil
}

return os.RemoveAll(drop)
}
Expand All @@ -104,6 +108,11 @@ func (b *SidecarMonitor) Prepare(spec program.Spec, pipelineID string, uid, gid
endpoint := MonitoringEndpoint(spec, b.operatingSystem, pipelineID, true)
drop := monitoringDrop(endpoint)

if drop == "" {
// not exposed using sockets
return nil
}

if err := os.MkdirAll(drop, 0775); err != nil {
return errors.New(err, fmt.Sprintf("failed to create a directory %q", drop))
}
Expand Down

0 comments on commit e184051

Please sign in to comment.