Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exec plugin: allow using glob pattern in command list #1142

Closed
wants to merge 1 commit into from

Conversation

peekeri
Copy link

@peekeri peekeri commented May 3, 2016

Allow using glob pattern in the command list in configuration. This enables for
example placing all commands in a single directory and using /path/to/dir/*.sh
as one of the commands to run all shell scripts in that directory.

Glob patterns are applied on every run of the commands, so matching commands can
be added without restarting telegraf.

This is a second try for this change. The previous PR #1127 broke existing functionality in two ways:

  • commands with arguments got ignored
  • commands in PATH got ignored

These issues are addressed now by:

  • splitting the command into actual command and arguments before globbing
  • using the command as-is in case glob returns no matches.

Added also a couple of tests to see that those are actually fixed. Not sure though if we can assume presence of /bin/echo?

@sparrc
Copy link
Contributor

sparrc commented May 3, 2016

@peekeri sorry about that, we had a problem with our CI script, please rebase and try pushing again

@peekeri
Copy link
Author

peekeri commented May 6, 2016

@sparrc all tests passed now. Is it ok to assume that /bin/echo is present when running the tests? Tests passed at least, so I guess from that point of view it is ok, but do the tests have to pass for example on Windows machine?

@sparrc
Copy link
Contributor

sparrc commented May 18, 2016

please limit line lengths to 80 characters, especially for the config file.

Also please rebase and update the changelog again so that your change falls into the 0.13.1 release.

Allow using glob pattern in the command list in configuration. This enables for
example placing all commands in a single directory and using /path/to/dir/*.sh
as one of the commands to run all shell scripts in that directory.

Glob patterns are applied on every run of the commands, so matching commands can
be added without restarting telegraf.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants