versioning: plugins report a list of supported versions
Further progress on versioning support (Issue #266). Bump CNI spec version to 0.3.0
This commit is contained in:
@ -23,6 +23,7 @@ import (
|
||||
"os/exec"
|
||||
|
||||
"github.com/containernetworking/cni/pkg/types"
|
||||
"github.com/containernetworking/cni/pkg/version"
|
||||
)
|
||||
|
||||
func pluginErr(err error, output []byte) error {
|
||||
@ -57,6 +58,15 @@ func ExecPluginWithoutResult(pluginPath string, netconf []byte, args CNIArgs) er
|
||||
return err
|
||||
}
|
||||
|
||||
func ExecPluginForVersion(pluginPath string) (version.PluginInfo, error) {
|
||||
stdoutBytes, err := execPlugin(pluginPath, nil, &Args{Command: "VERSION"})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return version.Decode(stdoutBytes)
|
||||
}
|
||||
|
||||
func execPlugin(pluginPath string, netconf []byte, args CNIArgs) ([]byte, error) {
|
||||
return defaultRawExec.ExecPlugin(pluginPath, netconf, args.AsEnv())
|
||||
}
|
||||
|
Reference in New Issue
Block a user