Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Adds log capturing from plugins to be carried through to snapd's logs
Browse files Browse the repository at this point in the history
  • Loading branch information
pittma authored and jcooklin committed Jul 14, 2016
1 parent 669a441 commit 5d91b04
Show file tree
Hide file tree
Showing 13 changed files with 189 additions and 562 deletions.
2 changes: 1 addition & 1 deletion control/available_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ type availablePlugin struct {

// newAvailablePlugin returns an availablePlugin with information from a
// plugin.Response
func newAvailablePlugin(resp *plugin.Response, emitter gomit.Emitter, ep executablePlugin) (*availablePlugin, error) {
func newAvailablePlugin(resp plugin.Response, emitter gomit.Emitter, ep executablePlugin) (*availablePlugin, error) {
if resp.Type != plugin.CollectorPluginType && resp.Type != plugin.ProcessorPluginType && resp.Type != plugin.PublisherPluginType {
return nil, strategy.ErrBadType
}
Expand Down
4 changes: 2 additions & 2 deletions control/available_plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestAvailablePlugin(t *testing.T) {
Convey("returns an availablePlugin", func() {
ln, _ := net.Listen("tcp", ":4000")
defer ln.Close()
resp := &plugin.Response{
resp := plugin.Response{
Meta: plugin.PluginMeta{
Name: "testPlugin",
Version: 1,
Expand Down Expand Up @@ -104,7 +104,7 @@ func TestAvailablePlugins(t *testing.T) {
})
})
Convey("it returns an error if client cannot be created", t, func() {
resp := &plugin.Response{
resp := plugin.Response{
Meta: plugin.PluginMeta{
Name: "test",
Version: 1,
Expand Down
11 changes: 4 additions & 7 deletions control/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,10 @@ var (
ErrControllerNotStarted = errors.New("Must start Controller before use")
)

type executablePlugins []plugin.ExecutablePlugin

type pluginControl struct {
// TODO, going to need coordination on changing of these
RunningPlugins executablePlugins
Started bool
Config *Config
Started bool
Config *Config

autodiscoverPaths []string
eventManager *gomit.EventController
Expand Down Expand Up @@ -361,9 +358,9 @@ func (p *pluginControl) Stop() {
}

// stop running plugins
for _, rp := range p.RunningPlugins {
for _, rp := range p.pluginRunner.AvailablePlugins().all() {
controlLogger.Debug("Stopping running plugin")
rp.Kill()
rp.Stop("daemon exiting")
}

// unload plugins
Expand Down
Loading

0 comments on commit 5d91b04

Please sign in to comment.