Skip to content

Commit

Permalink
Merge pull request #1283 from weaveworks/1282-plugin-panic
Browse files Browse the repository at this point in the history
Don't add plugin registry if creating it fails
  • Loading branch information
paulbellamy committed Apr 13, 2016
2 parents b74b394 + a171dd2 commit 12b4074
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions prog/probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,6 @@ func probeMain() {
log.Infof("probe starting, version %s, ID %s", version, probeID)
go check()

pluginRegistry, err := plugins.NewRegistry(
*pluginsRoot,
pluginAPIVersion,
map[string]string{
"probe_id": probeID,
"api_version": pluginAPIVersion,
},
)
if err != nil {
log.Errorf("plugins: problem loading: %v", err)
}
defer pluginRegistry.Close()

if len(flag.Args()) > 0 {
targets = flag.Args()
}
Expand Down Expand Up @@ -206,7 +193,20 @@ func probeMain() {
}
}

p.AddReporter(pluginRegistry)
pluginRegistry, err := plugins.NewRegistry(
*pluginsRoot,
pluginAPIVersion,
map[string]string{
"probe_id": probeID,
"api_version": pluginAPIVersion,
},
)
if err != nil {
log.Errorf("plugins: problem loading: %v", err)
} else {
defer pluginRegistry.Close()
p.AddReporter(pluginRegistry)
}

if *httpListen != "" {
go func() {
Expand Down

0 comments on commit 12b4074

Please sign in to comment.