summaryrefslogtreecommitdiff
path: root/cmd/podman/common
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-01-25 09:41:55 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2021-01-25 14:58:24 -0500
commit5623cb9d3d722a7015a395b31ce9ee7d9954bed9 (patch)
tree3d60e8ff3f29902dc082ec0ecce1a5a52c804579 /cmd/podman/common
parent23b879d72f9e2cf2b2d3924399605e0edebaa977 (diff)
downloadpodman-5623cb9d3d722a7015a395b31ce9ee7d9954bed9.tar.gz
podman-5623cb9d3d722a7015a395b31ce9ee7d9954bed9.tar.bz2
podman-5623cb9d3d722a7015a395b31ce9ee7d9954bed9.zip
Fix --arch and --os flags to work correctly
Currently podman implements --override-arch and --overide-os But Podman has made these aliases for --arch and --os. No reason to have to specify --override, since it is clear what the user intends. Currently if the user specifies an --override-arch field but the image was previously pulled for a different Arch, podman run uses the different arch. This PR also fixes this issue. Fixes: https://github.com/containers/podman/issues/8001 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman/common')
-rw-r--r--cmd/podman/common/create.go26
-rw-r--r--cmd/podman/common/create_opts.go12
2 files changed, 19 insertions, 19 deletions
diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go
index 17fba5427..915ff63b6 100644
--- a/cmd/podman/common/create.go
+++ b/cmd/podman/common/create.go
@@ -474,29 +474,29 @@ func DefineCreateFlags(cmd *cobra.Command, cf *ContainerCLIOpts) {
)
_ = cmd.RegisterFlagCompletionFunc(oomScoreAdjFlagName, completion.AutocompleteNone)
- overrideArchFlagName := "override-arch"
+ archFlagName := "arch"
createFlags.StringVar(
- &cf.OverrideArch,
- overrideArchFlagName, "",
+ &cf.Arch,
+ archFlagName, "",
"use `ARCH` instead of the architecture of the machine for choosing images",
)
- _ = cmd.RegisterFlagCompletionFunc(overrideArchFlagName, completion.AutocompleteNone)
+ _ = cmd.RegisterFlagCompletionFunc(archFlagName, completion.AutocompleteArch)
- overrideOSFlagName := "override-os"
+ osFlagName := "os"
createFlags.StringVar(
- &cf.OverrideOS,
- overrideOSFlagName, "",
+ &cf.OS,
+ osFlagName, "",
"use `OS` instead of the running OS for choosing images",
)
- _ = cmd.RegisterFlagCompletionFunc(overrideOSFlagName, completion.AutocompleteNone)
+ _ = cmd.RegisterFlagCompletionFunc(osFlagName, completion.AutocompleteOS)
- overrideVariantFlagName := "override-variant"
+ variantFlagName := "variant"
createFlags.StringVar(
- &cf.OverrideVariant,
- overrideVariantFlagName, "",
+ &cf.Variant,
+ variantFlagName, "",
"Use _VARIANT_ instead of the running architecture variant for choosing images",
)
- _ = cmd.RegisterFlagCompletionFunc(overrideVariantFlagName, completion.AutocompleteNone)
+ _ = cmd.RegisterFlagCompletionFunc(variantFlagName, completion.AutocompleteNone)
pidFlagName := "pid"
createFlags.String(
@@ -516,7 +516,7 @@ func DefineCreateFlags(cmd *cobra.Command, cf *ContainerCLIOpts) {
createFlags.StringVar(
&cf.Platform,
platformFlagName, "",
- "Specify the platform for selecting the image. (Conflicts with override-arch and override-os)",
+ "Specify the platform for selecting the image. (Conflicts with --arch and --os)",
)
_ = cmd.RegisterFlagCompletionFunc(platformFlagName, completion.AutocompleteNone)
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go
index f252618ce..a4da8da9e 100644
--- a/cmd/podman/common/create_opts.go
+++ b/cmd/podman/common/create_opts.go
@@ -73,9 +73,9 @@ type ContainerCLIOpts struct {
NoHealthCheck bool
OOMKillDisable bool
OOMScoreAdj int
- OverrideArch string
- OverrideOS string
- OverrideVariant string
+ Arch string
+ OS string
+ Variant string
PID string
PIDsLimit *int64
Platform string
@@ -346,9 +346,9 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup
LogOptions: stringMaptoArray(cc.HostConfig.LogConfig.Config),
Name: cc.Name,
OOMScoreAdj: cc.HostConfig.OomScoreAdj,
- OverrideArch: "",
- OverrideOS: "",
- OverrideVariant: "",
+ Arch: "",
+ OS: "",
+ Variant: "",
PID: string(cc.HostConfig.PidMode),
PIDsLimit: cc.HostConfig.PidsLimit,
Privileged: cc.HostConfig.Privileged,