summaryrefslogtreecommitdiff
path: root/pkg/specgen
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-05-06 13:49:07 +0200
committerPaul Holzinger <pholzing@redhat.com>2022-05-06 14:05:45 +0200
commited8c1dfb4c62b05a944c811d49cd56d21c1c1ede (patch)
treeeb0a93700366ae66d7b6443eaf7e40be5c159563 /pkg/specgen
parent5d5cb402cb6be818d6efd52d2198b00a55df0f1b (diff)
downloadpodman-ed8c1dfb4c62b05a944c811d49cd56d21c1c1ede.tar.gz
podman-ed8c1dfb4c62b05a944c811d49cd56d21c1c1ede.tar.bz2
podman-ed8c1dfb4c62b05a944c811d49cd56d21c1c1ede.zip
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 <pholzing@redhat.com>
Diffstat (limited to 'pkg/specgen')
-rw-r--r--pkg/specgen/generate/container.go6
1 files changed, 5 insertions, 1 deletions
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