Skip to content

Commit

Permalink
Fix go plugins not loaded when beat starts (elastic#4799)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjsamuel authored and exekias committed Aug 16, 2017
1 parent 58b617a commit 04f6356
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ https://github.com/elastic/beats/compare/v6.0.0-beta1...master[Check the HEAD di

*Affecting all Beats*

- Fix go plugins not loaded when beat starts {pull}4799[4799]

*Auditbeat*

*Filebeat*
Expand Down
3 changes: 3 additions & 0 deletions libbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ func GenRootCmdWithRunFlags(name, version string, beatCreator beat.Creator, runF
rootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("path.logs"))
rootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("path.home"))
rootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("strict.perms"))
if f := flag.CommandLine.Lookup("plugin"); f != nil {
rootCmd.PersistentFlags().AddGoFlag(f)
}

// Inherit root flags from run command
// TODO deprecate when root command no longer executes run (7.0)
Expand Down
8 changes: 6 additions & 2 deletions libbeat/plugin/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ func (p *pluginList) String() string {
}

func (p *pluginList) Set(v string) error {
// TODO: check file exists

for _, path := range p.paths {
if path == v {
logp.Warn("%s is already a registered plugin")
return nil
}
}
p.paths = append(p.paths, v)
return nil
}
Expand Down

0 comments on commit 04f6356

Please sign in to comment.