Merge remote-tracking branch 'upstream/master' into dev/static-args

This commit is contained in:
Tomofumi Hayashi
2018-09-05 14:39:16 +09:00
45 changed files with 1226 additions and 202 deletions

View File

@ -57,7 +57,13 @@ type Address struct {
}
func main() {
skel.PluginMain(cmdAdd, cmdDel, version.All)
// TODO: implement plugin version
skel.PluginMain(cmdAdd, cmdGet, cmdDel, version.All, "TODO")
}
func cmdGet(args *skel.CmdArgs) error {
// TODO: implement
return fmt.Errorf("not implemented")
}
// canonicalizeIP makes sure a provided ip is in standard form
@ -72,7 +78,9 @@ func canonicalizeIP(ip *net.IP) error {
return fmt.Errorf("IP %s not v4 nor v6", *ip)
}
// NewIPAMConfig creates a NetworkConfig from the given network name.
// LoadIPAMConfig creates IPAMConfig using json encoded configuration provided
// as `bytes`. At the moment values provided in envArgs are ignored so there
// is no possibility to overload the json configuration using envArgs
func LoadIPAMConfig(bytes []byte, envArgs string) (*IPAMConfig, string, error) {
n := Net{}
if err := json.Unmarshal(bytes, &n); err != nil {
@ -167,7 +175,6 @@ func cmdAdd(args *skel.CmdArgs) error {
Gateway: v.Gateway})
}
result.Routes = ipamConf.Routes
return types.PrintResult(result, confVersion)
}