summaryrefslogtreecommitdiff
path: root/libpod/network/files.go
diff options
context:
space:
mode:
authorPaul Holzinger <paul.holzinger@web.de>2020-11-26 17:15:06 +0100
committerPaul Holzinger <paul.holzinger@web.de>2020-11-26 21:42:28 +0100
commit2f7bca0685c611d118db98f4c1a5f06370a9e286 (patch)
tree403a2dc70bd0ff83536242e356f3306b6f46e5f3 /libpod/network/files.go
parentd4083954f26761b66f9165e40b08d1e6fe989c1c (diff)
downloadpodman-2f7bca0685c611d118db98f4c1a5f06370a9e286.tar.gz
podman-2f7bca0685c611d118db98f4c1a5f06370a9e286.tar.bz2
podman-2f7bca0685c611d118db98f4c1a5f06370a9e286.zip
Fix problems with network remove
First, make sure we are only trying to remove the network interface if we are root. Second, if we cannot get the interface name (e.g macvlan config) then we should not fail. Just remove the config file. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'libpod/network/files.go')
-rw-r--r--libpod/network/files.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/libpod/network/files.go b/libpod/network/files.go
index 846e5c62d..7f1e3ee18 100644
--- a/libpod/network/files.go
+++ b/libpod/network/files.go
@@ -14,6 +14,9 @@ import (
"github.com/pkg/errors"
)
+// ErrNoSuchNetworkInterface indicates that no network interface exists
+var ErrNoSuchNetworkInterface = errors.New("unable to find interface name for network")
+
// GetCNIConfDir get CNI configuration directory
func GetCNIConfDir(configArg *config.Config) string {
if len(configArg.Network.NetworkConfigDir) < 1 {
@@ -142,7 +145,7 @@ func GetInterfaceNameFromConfig(path string) (string, error) {
}
}
if len(name) == 0 {
- return "", errors.New("unable to find interface name for network")
+ return "", ErrNoSuchNetworkInterface
}
return name, nil
}