libnetwork/drivers/bridge: link.Enable: don't register reload on error
Only register a reload function if we actually managed to enable the link. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
0f4ba145ee
commit
8b6203b613
1 changed files with 5 additions and 2 deletions
|
@ -36,9 +36,12 @@ func (l *link) Enable() error {
|
|||
linkFunction := func() error {
|
||||
return linkContainers(iptables.Append, l.parentIP, l.childIP, l.ports, l.bridge, false)
|
||||
}
|
||||
if err := linkFunction(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
iptables.OnReloaded(func() { linkFunction() })
|
||||
return linkFunction()
|
||||
iptables.OnReloaded(func() { _ = linkFunction() })
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *link) Disable() {
|
||||
|
|
Loading…
Add table
Reference in a new issue