libnetwork: Controller.cleanupLocalEndpoints: return errors

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-08-16 20:12:42 +02:00
parent 2e60051c92
commit a8ea752a93
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 7 additions and 4 deletions

View file

@ -151,7 +151,9 @@ func New(cfgOptions ...config.Option) (*Controller, error) {
if err := c.sandboxCleanup(c.cfg.ActiveSandboxes); err != nil {
log.G(context.TODO()).WithError(err).Error("error during sandbox cleanup")
}
c.cleanupLocalEndpoints()
if err := c.cleanupLocalEndpoints(); err != nil {
log.G(context.TODO()).WithError(err).Warnf("error during endpoint cleanup")
}
c.networkCleanup()
if err := c.startExternalKeyListener(); err != nil {

View file

@ -1144,7 +1144,7 @@ func (ep *Endpoint) releaseAddress() {
}
}
func (c *Controller) cleanupLocalEndpoints() {
func (c *Controller) cleanupLocalEndpoints() error {
// Get used endpoints
eps := make(map[string]interface{})
for _, sb := range c.sandboxes {
@ -1154,8 +1154,7 @@ func (c *Controller) cleanupLocalEndpoints() {
}
nl, err := c.getNetworks()
if err != nil {
log.G(context.TODO()).Warnf("Could not get list of networks during endpoint cleanup: %v", err)
return
return fmt.Errorf("could not get list of networks: %v", err)
}
for _, n := range nl {
@ -1192,4 +1191,6 @@ func (c *Controller) cleanupLocalEndpoints() {
}
}
}
return nil
}