From ed8c1dfb4c62b05a944c811d49cd56d21c1c1ede Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Fri, 6 May 2022 13:49:07 +0200 Subject: libpod: add c.ConfigWithNetworks() Reading the networks requires an extra db operation. Most c.Config() callers do not need them so create a new function which returns the config with networks. [NO NEW TESTS NEEDED] Signed-off-by: Paul Holzinger --- pkg/specgen/generate/container.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pkg/specgen/generate') diff --git a/pkg/specgen/generate/container.go b/pkg/specgen/generate/container.go index 63caaa77c..d8008b10b 100644 --- a/pkg/specgen/generate/container.go +++ b/pkg/specgen/generate/container.go @@ -3,6 +3,7 @@ package generate import ( "context" "encoding/json" + "fmt" "os" "strings" "time" @@ -352,7 +353,10 @@ func ConfigToSpec(rt *libpod.Runtime, specg *specgen.SpecGenerator, contaierID s if err != nil { return nil, nil, err } - conf := c.Config() + conf := c.ConfigWithNetworks() + if conf == nil { + return nil, nil, fmt.Errorf("failed to get config for container %s", c.ID()) + } tmpSystemd := conf.Systemd tmpMounts := conf.Mounts -- cgit v1.2.3-54-g00ecf