From 762148deb6be6925d17bd12f219f7385e1402439 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Mon, 15 Mar 2021 10:45:24 +0100 Subject: Split libpod/network package The `libpod/network` package should only be used on the backend and not the client. The client used this package only for two functions so move them into a new `pkg/network` package. This is needed so we can put linux only code into `libpod/network`, see #9710. [NO TESTS NEEDED] Signed-off-by: Paul Holzinger --- libpod/network/files.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'libpod/network/files.go') diff --git a/libpod/network/files.go b/libpod/network/files.go index fe483e25c..d876113f9 100644 --- a/libpod/network/files.go +++ b/libpod/network/files.go @@ -11,6 +11,7 @@ import ( "github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator" "github.com/containers/common/pkg/config" "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/network" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -67,7 +68,7 @@ func GetCNIConfigPathByNameOrID(config *config.Config, name string) (string, err if conf.Name == name { return confFile, nil } - if strings.HasPrefix(GetNetworkID(conf.Name), name) { + if strings.HasPrefix(network.GetNetworkID(conf.Name), name) { idMatch++ file = confFile } @@ -92,16 +93,6 @@ func ReadRawCNIConfByNameOrID(config *config.Config, name string) ([]byte, error return b, err } -// GetCNIPlugins returns a list of plugins that a given network -// has in the form of a string -func GetCNIPlugins(list *libcni.NetworkConfigList) string { - plugins := make([]string, 0, len(list.Plugins)) - for _, plug := range list.Plugins { - plugins = append(plugins, plug.Network.Type) - } - return strings.Join(plugins, ",") -} - // GetNetworkLabels returns a list of labels as a string func GetNetworkLabels(list *libcni.NetworkConfigList) NcLabels { cniJSON := make(map[string]interface{}) -- cgit v1.2.3-54-g00ecf