Skip to content

fix(agent): Error out if configuration directory is not readable#18572

Merged
mstrandboge merged 11 commits intoinfluxdata:masterfrom
srebhan:config_issue_16600
Mar 27, 2026
Merged

fix(agent): Error out if configuration directory is not readable#18572
mstrandboge merged 11 commits intoinfluxdata:masterfrom
srebhan:config_issue_16600

Conversation

@srebhan
Copy link
Copy Markdown
Member

@srebhan srebhan commented Mar 19, 2026

Summary

Currently Telegraf will silently ignore any configuration directory specified via command-line if this directory cannot be read by the Telegraf user. This is bad because users will see missing plugins but get no indication whatsoever on what is going on.

This PR will error out if the directory cannot be read.

Checklist

Related issues

resolves #16600

@telegraf-tiger telegraf-tiger Bot added the fix pr to fix corresponding bug label Mar 19, 2026
@srebhan srebhan added area/aws AWS plugins including cloudwatch, ecs, kinesis area/agent and removed area/aws AWS plugins including cloudwatch, ecs, kinesis labels Mar 19, 2026
Copy link
Copy Markdown
Contributor

@skartikey skartikey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srebhan Thanks for the fix! The change to error out on unreadable config directories is solid.

The test failures on Linux and Windows CI are likely because TestLoadConfigurationsPermissions relies on Unix file permission enforcement, which doesn't hold when running as root (common in Docker-based CI) or on Windows. Adding skip guards should fix it:

  if runtime.GOOS == "windows" {                                                                                                                                                                                   
      t.Skip("Unix file permissions not supported on Windows")
  }
  if os.Getuid() == 0 {
      t.Skip("Cannot test permission restrictions as root")                                                                                                                                                        
  }   

Comment thread cmd/telegraf/telegraf_test.go
@srebhan srebhan requested a review from skartikey March 23, 2026 18:06
Copy link
Copy Markdown
Contributor

@skartikey skartikey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srebhan, some spelling typos.

Comment thread cmd/telegraf/telegraf_test.go Outdated
Comment thread cmd/telegraf/telegraf_test.go Outdated
Comment thread cmd/telegraf/telegraf_test.go Outdated
Comment thread cmd/telegraf/telegraf_test.go Outdated
Comment thread cmd/telegraf/telegraf_test.go Outdated
Comment thread cmd/telegraf/telegraf_test.go Outdated
srebhan and others added 6 commits March 23, 2026 21:38
Co-authored-by: skartikey <s.kartikey@gmail.com>
Co-authored-by: skartikey <s.kartikey@gmail.com>
Co-authored-by: skartikey <s.kartikey@gmail.com>
Co-authored-by: skartikey <s.kartikey@gmail.com>
Co-authored-by: skartikey <s.kartikey@gmail.com>
Co-authored-by: skartikey <s.kartikey@gmail.com>
@srebhan srebhan requested a review from skartikey March 23, 2026 20:39
Copy link
Copy Markdown
Contributor

@skartikey skartikey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srebhan Thanks!

@skartikey skartikey removed their assignment Mar 23, 2026
@skartikey skartikey added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Mar 23, 2026
@telegraf-tiger
Copy link
Copy Markdown
Contributor

@mstrandboge mstrandboge merged commit 5d40e2a into influxdata:master Mar 27, 2026
27 checks passed
@github-actions github-actions Bot added this to the v1.38.2 milestone Mar 27, 2026
srebhan added a commit that referenced this pull request Mar 30, 2026
)

Co-authored-by: skartikey <s.kartikey@gmail.com>
(cherry picked from commit 5d40e2a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent fix pr to fix corresponding bug ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegraf silently ignores config directory when permission denied

3 participants