From 667d74aaf7ed663f83f2820d7c04578d0b90710f Mon Sep 17 00:00:00 2001 From: Carlos de Paula Date: Fri, 6 Mar 2020 20:44:35 -0300 Subject: [PATCH] Skip adding function if GetFunction returns error When ListFunctions populate it's function map, it should not add functions that GetFunction returned error. Signed-off-by: Carlos de Paula --- pkg/provider/handlers/functions.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/provider/handlers/functions.go b/pkg/provider/handlers/functions.go index fdc2d8b..f350c55 100644 --- a/pkg/provider/handlers/functions.go +++ b/pkg/provider/handlers/functions.go @@ -33,7 +33,11 @@ func ListFunctions(client *containerd.Client) (map[string]Function, error) { containers, _ := client.Containers(ctx) for _, k := range containers { name := k.ID() - functions[name], _ = GetFunction(client, name) + f, err := GetFunction(client, name) + if err != nil { + continue + } + functions[name] = f } return functions, nil } @@ -44,7 +48,6 @@ func GetFunction(client *containerd.Client, name string) (Function, error) { c, err := client.LoadContainer(ctx, name) if err == nil { - image, _ := c.Image(ctx) containerName := c.ID()