mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-09 08:26:47 +00:00
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 <me@carlosedp.com>
This commit is contained in:
parent
9dcdbfb7e3
commit
667d74aaf7
@ -33,7 +33,11 @@ func ListFunctions(client *containerd.Client) (map[string]Function, error) {
|
|||||||
containers, _ := client.Containers(ctx)
|
containers, _ := client.Containers(ctx)
|
||||||
for _, k := range containers {
|
for _, k := range containers {
|
||||||
name := k.ID()
|
name := k.ID()
|
||||||
functions[name], _ = GetFunction(client, name)
|
f, err := GetFunction(client, name)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
functions[name] = f
|
||||||
}
|
}
|
||||||
return functions, nil
|
return functions, nil
|
||||||
}
|
}
|
||||||
@ -44,7 +48,6 @@ func GetFunction(client *containerd.Client, name string) (Function, error) {
|
|||||||
c, err := client.LoadContainer(ctx, name)
|
c, err := client.LoadContainer(ctx, name)
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
||||||
image, _ := c.Image(ctx)
|
image, _ := c.Image(ctx)
|
||||||
|
|
||||||
containerName := c.ID()
|
containerName := c.ID()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user