libcni: up-convert a Config to a ConfigList when no other configs are found.

This commit is contained in:
Casey Callendrello
2017-02-17 12:19:38 +01:00
parent 6f3b0abcc7
commit 6e6ad53ea8
3 changed files with 132 additions and 14 deletions

View File

@ -1,4 +1,4 @@
// Copyright 2015 CoreOS, Inc.
// Copyright 2015 CNI authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -42,7 +42,7 @@ func main() {
if netdir == "" {
netdir = DefaultNetDir
}
netconf, err := libcni.LoadConf(netdir, os.Args[2])
netconf, err := libcni.LoadConfList(netdir, os.Args[2])
if err != nil {
exit(err)
}
@ -61,10 +61,13 @@ func main() {
switch os.Args[1] {
case CmdAdd:
_, err := cninet.AddNetwork(netconf, rt)
result, err := cninet.AddNetworkList(netconf, rt)
if result != nil {
_ = result.Print()
}
exit(err)
case CmdDel:
exit(cninet.DelNetwork(netconf, rt))
exit(cninet.DelNetworkList(netconf, rt))
}
}