(ctx context.Context, projectName string, options api.StopOptions, event api.ContainerEventListener)
| 31 | } |
| 32 | |
| 33 | func (s *composeService) stop(ctx context.Context, projectName string, options api.StopOptions, event api.ContainerEventListener) error { |
| 34 | containers, err := s.getContainers(ctx, projectName, oneOffExclude, true) |
| 35 | if err != nil { |
| 36 | return err |
| 37 | } |
| 38 | |
| 39 | project := options.Project |
| 40 | if project == nil { |
| 41 | project, err = s.getProjectWithResources(ctx, containers, projectName) |
| 42 | if err != nil { |
| 43 | return err |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | if len(options.Services) == 0 { |
| 48 | options.Services = project.ServiceNames() |
| 49 | } |
| 50 | |
| 51 | return InReverseDependencyOrder(ctx, project, func(c context.Context, service string) error { |
| 52 | if !slices.Contains(options.Services, service) { |
| 53 | return nil |
| 54 | } |
| 55 | serv := project.Services[service] |
| 56 | if serv.Provider != nil { |
| 57 | return s.runPlugin(ctx, project, serv, "stop") |
| 58 | } |
| 59 | return s.stopContainers(ctx, &serv, containers.filter(isService(service)).filter(isNotOneOff), options.Timeout, event) |
| 60 | }) |
| 61 | } |
no test coverage detected