libnetwork: inline populateSpecial NetworkWalker
It was only used in a single place, and it was defined far away from where it was used. Move the code inline, so that it's clear at a glance what it's doing. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
e3975fba84
commit
7cda3fb7b5
2 changed files with 8 additions and 10 deletions
|
@ -140,7 +140,14 @@ func New(cfgOptions ...config.Option) (*Controller, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
c.WalkNetworks(populateSpecial)
|
||||
c.WalkNetworks(func(nw *Network) bool {
|
||||
if n := nw; n.hasSpecialDriver() && !n.ConfigOnly() {
|
||||
if err := n.getController().addNetwork(n); err != nil {
|
||||
log.G(context.TODO()).Warnf("Failed to populate network %q with driver %q", nw.Name(), nw.Type())
|
||||
}
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
// Reserve pools first before doing cleanup. Otherwise the
|
||||
// cleanups of endpoint/network and sandbox below will
|
||||
|
|
|
@ -287,12 +287,3 @@ func (c *Controller) networkCleanup() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
var populateSpecial NetworkWalker = func(nw *Network) bool {
|
||||
if n := nw; n.hasSpecialDriver() && !n.ConfigOnly() {
|
||||
if err := n.getController().addNetwork(n); err != nil {
|
||||
log.G(context.TODO()).Warnf("Failed to populate network %q with driver %q", nw.Name(), nw.Type())
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue