Print default plugin config.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu
2018-01-19 08:56:34 +00:00
parent 823d3398ea
commit 3d6fe5ad18
3 changed files with 36 additions and 16 deletions

View File

@@ -1,9 +1,6 @@
package server
import (
"bytes"
"io"
"github.com/BurntSushi/toml"
"github.com/containerd/containerd/errdefs"
"github.com/pkg/errors"
@@ -69,16 +66,6 @@ func (c *Config) Decode(id string, v interface{}) (interface{}, error) {
return v, nil
}
// WriteTo marshals the config to the provided writer
func (c *Config) WriteTo(w io.Writer) (int64, error) {
buf := bytes.NewBuffer(nil)
e := toml.NewEncoder(buf)
if err := e.Encode(c); err != nil {
return 0, err
}
return io.Copy(w, buf)
}
// LoadConfig loads the containerd server config from the provided path
func LoadConfig(path string, v *Config) error {
if v == nil {

View File

@@ -45,7 +45,7 @@ func New(ctx context.Context, config *Config) (*Server, error) {
if err := apply(ctx, config); err != nil {
return nil, err
}
plugins, err := loadPlugins(config)
plugins, err := LoadPlugins(config)
if err != nil {
return nil, err
}
@@ -158,7 +158,9 @@ func (s *Server) Stop() {
s.rpc.Stop()
}
func loadPlugins(config *Config) ([]*plugin.Registration, error) {
// LoadPlugins loads all plugins into containerd and generates an ordered graph
// of all plugins.
func LoadPlugins(config *Config) ([]*plugin.Registration, error) {
// load all plugins into containerd
if err := plugin.Load(filepath.Join(config.Root, "plugins")); err != nil {
return nil, err