Refactor the engine.Interface such that the Set() API does not return an extraneous error

Signed-off-by: Christopher Desiniotis <cdesiniotis@nvidia.com>
This commit is contained in:
Christopher Desiniotis
2023-12-01 15:59:34 -08:00
parent ffe7ed313a
commit 83ad09b179
7 changed files with 16 additions and 13 deletions

View File

@@ -135,11 +135,10 @@ func (c *ConfigV1) RemoveRuntime(name string) error {
}
// SetOption sets the specified containerd option.
func (c *ConfigV1) Set(key string, value interface{}) error {
func (c *ConfigV1) Set(key string, value interface{}) {
config := *c.Tree
config.SetPath([]string{"plugins", "cri", "containerd", key}, value)
*c.Tree = config
return nil
}
// Save wrotes the config to a file

View File

@@ -91,11 +91,10 @@ func (c *Config) getRuntimeAnnotations(path []string) ([]string, error) {
}
// Set sets the specified containerd option.
func (c *Config) Set(key string, value interface{}) error {
func (c *Config) Set(key string, value interface{}) {
config := *c.Tree
config.SetPath([]string{"plugins", "io.containerd.grpc.v1.cri", key}, value)
*c.Tree = config
return nil
}
// DefaultRuntime returns the default runtime for the cri-o config

View File

@@ -31,6 +31,8 @@ type Config struct {
ContainerAnnotations []string
}
var _ engine.Interface = (*Config)(nil)
// New creates a containerd config with the specified options
func New(opts ...Option) (engine.Interface, error) {
b := &builder{}