Simplify, after review feedback
This commit is contained in:
1 parent
ef892fd4ed
commit
b153e6a0d2
2 files changed
+6
-11
No files matched your search
+4
-10
@@ -109,19 +109,13 @@ func GetWeaveNetDevs(processID int) ([]NetDev, error) {
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var weaveBridge netlink.Link
|
weaveBridge, err := netlink.LinkByName("weave")
|
||||||
forEachLink(func(link netlink.Link) error {
|
if err != nil {
|
||||||
if link.Attrs().Name == "weave" {
|
return nil, fmt.Errorf("Cannot find weave bridge: %s", err)
|
||||||
weaveBridge = link
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
if weaveBridge == nil {
|
|
||||||
return nil, fmt.Errorf("Cannot find weave bridge")
|
|
||||||
}
|
}
|
||||||
// Scan devices in root namespace to find those attached to weave bridge
|
// Scan devices in root namespace to find those attached to weave bridge
|
||||||
indexes := make(map[int]struct{})
|
indexes := make(map[int]struct{})
|
||||||
err := forEachLink(func(link netlink.Link) error {
|
err = forEachLink(func(link netlink.Link) error {
|
||||||
if link.Attrs().MasterIndex == weaveBridge.Attrs().Index {
|
if link.Attrs().MasterIndex == weaveBridge.Attrs().Index {
|
||||||
indexes[link.Attrs().Index] = struct{}{}
|
indexes[link.Attrs().Index] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -26,7 +26,8 @@ var version = "(unreleased version)"
|
|||||||
func main() {
|
func main() {
|
||||||
var (
|
var (
|
||||||
justVersion bool
|
justVersion bool
|
||||||
cniNet, cniIpam bool
|
cniNet bool
|
||||||
|
cniIpam bool
|
||||||
address string
|
address string
|
||||||
meshAddress string
|
meshAddress string
|
||||||
logLevel string
|
logLevel string
|
||||||
|
|||||||
Reference in new issue
Block a user