Merge pull request #4605 from mxpv/nri-fix

Revendor NRI
This commit is contained in:
Michael Crosby 2020-10-07 13:57:37 -04:00 committed by GitHub
commit de546a154f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 2 deletions

View File

@ -7,7 +7,7 @@ github.com/containerd/console v1.0.1
github.com/containerd/continuity efbc4488d8fe1bdc16bde3b2d2990d9b3a899165
github.com/containerd/fifo f15a3290365b9d2627d189e619ab4008e0069caf
github.com/containerd/go-runc 7016d3ce2328dd2cb1192b2076ebd565c4e8df0c
github.com/containerd/nri 0afc7f031eaf9c7d9c1a381b7ab5462e89c998fc
github.com/containerd/nri eb1350a75164f76de48e3605389e7a3fbc85d06e
github.com/containerd/ttrpc v1.0.2
github.com/containerd/typeurl v1.0.1
github.com/coreos/go-systemd/v22 v22.1.0

View File

@ -7,6 +7,7 @@ import (
"fmt"
"os"
"os/exec"
"sync"
"github.com/containerd/containerd"
"github.com/containerd/containerd/oci"
@ -23,15 +24,22 @@ const (
Version = "0.1"
)
var appendPathOnce sync.Once
// New nri client
func New() (*Client, error) {
conf, err := loadConfig(DefaultConfPath)
if err != nil {
return nil, err
}
if err := os.Setenv("PATH", fmt.Sprintf("%s:%s", os.Getenv("PATH"), DefaultBinaryPath)); err != nil {
appendPathOnce.Do(func() {
err = os.Setenv("PATH", fmt.Sprintf("%s:%s", os.Getenv("PATH"), DefaultBinaryPath))
})
if err != nil {
return nil, err
}
return &Client{
conf: conf,
}, nil

View File

@ -81,6 +81,14 @@ type Request struct {
Results []*Result `json:"results,omitempty"`
}
// NewPluginError returns a plugin error
func NewPluginError(name string, err error) error {
return &PluginError{
Plugin: name,
Message: err.Error(),
}
}
// PluginError for specific plugin execution
type PluginError struct {
// Plugin name