diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2021-11-10 11:12:06 +0100 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2021-11-10 12:59:42 +0100 |
commit | df066643638d9763d186fea2e6a81633244d2f88 (patch) | |
tree | c0bba498c1c55dbce009393ade2e862946942d38 /cmd/podman/pods | |
parent | 5437568fcda04c2999b5fa9aad4dd07f2d3cfd67 (diff) | |
download | podman-df066643638d9763d186fea2e6a81633244d2f88.tar.gz podman-df066643638d9763d186fea2e6a81633244d2f88.tar.bz2 podman-df066643638d9763d186fea2e6a81633244d2f88.zip |
pod create: read infra image from containers.conf
Fix a bug where pods would be created with the hard-coded default infra
image instead of the custom one from containers.conf. Add a simple
regression test.
Fixes: #12245
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'cmd/podman/pods')
-rw-r--r-- | cmd/podman/pods/create.go | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/cmd/podman/pods/create.go b/cmd/podman/pods/create.go index b966706b4..0d759a586 100644 --- a/cmd/podman/pods/create.go +++ b/cmd/podman/pods/create.go @@ -11,7 +11,6 @@ import ( "strings" "github.com/containers/common/pkg/completion" - "github.com/containers/common/pkg/config" "github.com/containers/common/pkg/sysinfo" "github.com/containers/podman/v3/cmd/podman/common" "github.com/containers/podman/v3/cmd/podman/containers" @@ -48,6 +47,7 @@ var ( var ( createOptions entities.PodCreateOptions infraOptions entities.ContainerCreateOptions + infraImage string labels, labelFile []string podIDFile string replace bool @@ -72,7 +72,7 @@ func init() { _ = createCommand.RegisterFlagCompletionFunc(nameFlagName, completion.AutocompleteNone) infraImageFlagName := "infra-image" - flags.String(infraImageFlagName, containerConfig.Engine.InfraImage, "The image of the infra container to associate with the pod") + flags.StringVar(&infraImage, infraImageFlagName, containerConfig.Engine.InfraImage, "The image of the infra container to associate with the pod") _ = createCommand.RegisterFlagCompletionFunc(infraImageFlagName, common.AutocompleteImages) podIDFileFlagName := "pod-id-file" @@ -110,7 +110,7 @@ func create(cmd *cobra.Command, args []string) error { return errors.Wrapf(err, "unable to process labels") } - imageName = config.DefaultInfraImage + imageName = infraImage img := imageName if !createOptions.Infra { if cmd.Flag("no-hosts").Changed { @@ -151,14 +151,6 @@ func create(cmd *cobra.Command, args []string) error { return err } } - if cmd.Flag("infra-image").Changed { - // Only send content to server side if user changed defaults - img, err = cmd.Flags().GetString("infra-image") - imageName = img - if err != nil { - return err - } - } podName = createOptions.Name err = common.ContainerToPodOptions(&infraOptions, &createOptions) if err != nil { |