Print default plugin config.
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user