Fixing panic when sandbox is nil
@@ -525,18 +525,24 @@ func (daemon *Daemon) deleteLoadBalancerSandbox(n libnetwork.Network) {
if len(endpoints) == 1 {
sandboxName := n.Name() + "-sbox"
- if err := endpoints[0].Info().Sandbox().DisableService(); err != nil {
- logrus.Errorf("Failed to disable service on sandbox %s: %v", sandboxName, err)
+ info := endpoints[0].Info()
+ if info != nil {
+ sb := info.Sandbox()
+ if sb != nil {
+ if err := sb.DisableService(); err != nil {
+ logrus.Warnf("Failed to disable service on sandbox %s: %v", sandboxName, err)
//Ignore error and attempt to delete the load balancer endpoint
}
+ }
+ }
if err := endpoints[0].Delete(true); err != nil {
- logrus.Errorf("Failed to delete endpoint %s (%s) in %s: %v", endpoints[0].Name(), endpoints[0].ID(), sandboxName, err)
+ logrus.Warnf("Failed to delete endpoint %s (%s) in %s: %v", endpoints[0].Name(), endpoints[0].ID(), sandboxName, err)
//Ignore error and attempt to delete the sandbox.
}
if err := controller.SandboxDestroy(sandboxName); err != nil {
- logrus.Errorf("Failed to delete %s sandbox: %v", sandboxName, err)
+ logrus.Warnf("Failed to delete %s sandbox: %v", sandboxName, err)
//Ignore error and attempt to delete the network.
}
}
