Beispiel #1
0
func cmdListPlugins(c *cli.Context) {
	allPlugins := plugins.GetPlugins()
	w := tabwriter.NewWriter(os.Stdout, 8, 1, 3, ' ', 0)

	fmt.Fprintln(w, "NAME\tVERSION\tDESCRIPTION\tURL")

	for _, p := range allPlugins {
		i := p.Info()
		fmt.Fprintf(w, "%s\t%s\t%s\t%s\n",
			i.Name,
			i.Version,
			i.Description,
			i.Url,
		)
	}
	w.Flush()
}
Beispiel #2
0
func (m *Manager) Run() error {
	if err := m.connect(); err != nil {
		return err
	}

	go func() {
		for {
			err := <-eventsErrChan
			log.Error(err)
		}
	}()

	// plugins
	allPlugins := plugins.GetPlugins()
	if len(allPlugins) == 0 || len(m.Config.EnabledPlugins) == 0 {
		log.Warnf("no plugins enabled")
	}

	enabledPlugins := make(map[string]*plugins.RegisteredPlugin)

	for _, v := range m.Config.EnabledPlugins {
		if p, ok := allPlugins[v]; ok {
			log.Infof("loading plugin name=%s version=%s",
				p.Info().Name,
				p.Info().Version)
			enabledPlugins[v] = p
		}
	}

	plugins.SetEnabledPlugins(enabledPlugins)

	// custom event to signal startup
	evt := &dockerclient.Event{
		Id:     "",
		Status: "interlock-start",
		From:   "interlock",
		Time:   time.Now().UnixNano(),
	}
	plugins.DispatchEvent(m.Config, m.Client, evt, eventsErrChan)
	return nil
}