| 178 | } |
| 179 | |
| 180 | func (s *composeService) ensureNetworksDown(ctx context.Context, project *types.Project) []downOp { |
| 181 | var ops []downOp |
| 182 | for key, n := range project.Networks { |
| 183 | if n.External { |
| 184 | continue |
| 185 | } |
| 186 | // loop capture variable for op closure |
| 187 | networkKey := key |
| 188 | idOrName := n.Name |
| 189 | ops = append(ops, func() error { |
| 190 | return s.removeNetwork(ctx, networkKey, project.Name, idOrName) |
| 191 | }) |
| 192 | } |
| 193 | return ops |
| 194 | } |
| 195 | |
| 196 | func (s *composeService) removeNetwork(ctx context.Context, composeNetworkName string, projectName string, name string) error { |
| 197 | res, err := s.apiClient().NetworkList(ctx, client.NetworkListOptions{ |