MCPcopy Create free account
hub / github.com/Scalingo/cli / keepUniqueContainersWithNames

Function keepUniqueContainersWithNames

apps/sendsignal.go:32–53  ·  view source on GitHub ↗
(ctx context.Context, containers []scalingo.Container, names []string)

Source from the content-addressed store, hash-verified

30}
31
32func keepUniqueContainersWithNames(ctx context.Context, containers []scalingo.Container, names []string) map[string]scalingo.Container {
33 containersToKill := map[string]scalingo.Container{}
34
35 for _, name := range names {
36 for _, container := range containers {
37 if container.Label == name {
38 containersToKill[name] = container
39 }
40 }
41 if _, ok := containersToKill[name]; !ok {
42 containersToKillWithType, err := keepUniqueContainersWithType(ctx, containers, name)
43 if err != nil {
44 io.Error(err.Error())
45 continue
46 }
47
48 maps.Copy(containersToKill, containersToKillWithType)
49 }
50 }
51
52 return containersToKill
53}
54
55func SendSignal(ctx context.Context, appName string, signal string, containerNames []string) error {
56 if len(containerNames) == 0 {

Callers 1

SendSignalFunction · 0.85

Calls 3

ErrorFunction · 0.92
ErrorMethod · 0.80

Tested by

no test coverage detected