MCPcopy
hub / github.com/amir20/dozzle / removeProjectNetworks

Method removeProjectNetworks

internal/deploy/deployer.go:182–202  ·  view source on GitHub ↗
(ctx context.Context, projectName string)

Source from the content-addressed store, hash-verified

180}
181
182func (d *Deployer) removeProjectNetworks(ctx context.Context, projectName string) error {
183 networks, err := d.cli.NetworkList(ctx, client.NetworkListOptions{
184 Filters: make(client.Filters).Add("label", labelComposeProject+"="+projectName),
185 })
186 if err != nil {
187 return fmt.Errorf("listing networks: %w", err)
188 }
189 g, gctx := errgroup.WithContext(ctx)
190 g.SetLimit(5)
191 for _, n := range networks.Items {
192 g.Go(func() error {
193 if _, err := d.cli.NetworkRemove(gctx, n.ID, client.NetworkRemoveOptions{}); err != nil {
194 log.Warn().Err(err).Str("network", n.Name).Msg("Failed to remove network")
195 return err
196 }
197 log.Info().Str("network", n.Name).Msg("Removed network")
198 return nil
199 })
200 }
201 return g.Wait()
202}
203
204func (d *Deployer) removeProjectVolumes(ctx context.Context, projectName string) error {
205 vols, err := d.cli.VolumeList(ctx, client.VolumeListOptions{

Callers 1

RemoveMethod · 0.95

Calls 4

InfoMethod · 0.80
WaitMethod · 0.80
NetworkListMethod · 0.65
NetworkRemoveMethod · 0.65

Tested by

no test coverage detected