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:
Gabe Rosenhouse
2016-08-21 23:48:04 -07:00
parent 63ace9e496
commit b1e254d901
6 changed files with 196 additions and 46 deletions

View File

@ -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())
}