Skip to content

Commit c593aa5

Browse files
authored
Do not treat missing network as error when deleting network (#1050)
Previously the code treated a missing network as an error condition during deletion. This leads to some unhelpful warning messages in the log when cleaning up a workload. Remove the error, but leave a debug-level log in case it is useful for debugging networking problems.
1 parent da7f19e commit c593aa5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/container/docker/client.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1386,8 +1386,11 @@ func (c *Client) deleteNetwork(ctx context.Context, name string) error {
13861386
if err != nil {
13871387
return err
13881388
}
1389+
1390+
// If the network does not exist, there is nothing to do here.
13891391
if len(networks) == 0 {
1390-
return fmt.Errorf("network %s not found", name)
1392+
logger.Debugf("network %s not found, nothing to delete", name)
1393+
return nil
13911394
}
13921395

13931396
if err := c.client.NetworkRemove(ctx, networks[0].ID); err != nil {

0 commit comments

Comments
 (0)