dont try to remove builtin networks in teardown

Signed-off-by: Shijiang Wei <mountkin@gmail.com>
This commit is contained in:
Shijiang Wei 2015-10-30 23:05:33 +08:00
parent 1795eb9545
commit 5970e94072

View file

@ -598,15 +598,16 @@ func deleteAllNetworks() error {
}
var errors []string
for _, n := range networks {
if n.Name != "bridge" {
status, b, err := sockRequest("DELETE", "/networks/"+n.Name, nil)
if err != nil {
errors = append(errors, err.Error())
continue
}
if status != http.StatusNoContent {
errors = append(errors, fmt.Sprintf("error deleting network %s: %s", n.Name, string(b)))
}
if n.Name == "bridge" || n.Name == "none" || n.Name == "host" {
continue
}
status, b, err := sockRequest("DELETE", "/networks/"+n.Name, nil)
if err != nil {
errors = append(errors, err.Error())
continue
}
if status != http.StatusNoContent {
errors = append(errors, fmt.Sprintf("error deleting network %s: %s", n.Name, string(b)))
}
}
if len(errors) > 0 {