mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Cleanup on error in ProgramExternalConnectivity
Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
parent
2a1ea8a642
commit
bace4fb6ff
1 changed files with 10 additions and 1 deletions
|
@ -1243,8 +1243,17 @@ func (d *driver) ProgramExternalConnectivity(nid, eid string, options map[string
|
|||
return err
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if e := network.releasePorts(endpoint); e != nil {
|
||||
logrus.Errorf("Failed to release ports allocated for the bridge endpoint %s on failure %v because of %v",
|
||||
eid, err, e)
|
||||
}
|
||||
endpoint.portMapping = nil
|
||||
}
|
||||
}()
|
||||
|
||||
if err = d.storeUpdate(endpoint); err != nil {
|
||||
endpoint.portMapping = nil
|
||||
return fmt.Errorf("failed to update bridge endpoint %s to store: %v", endpoint.id[0:7], err)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue