libcni: up-convert a Config to a ConfigList when no other configs are found.
This commit is contained in:
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user