Skip to content

Commit

Permalink
Fix failures when using npipe monitoring endpoints (#1371)
Browse files Browse the repository at this point in the history
(cherry picked from commit e184051)
  • Loading branch information
michalpristas authored and mergify[bot] committed Sep 29, 2022
1 parent 2c0523e commit bfcf1db
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 bfcf1db

Please sign in to comment.