summaryrefslogtreecommitdiff
path: root/cmd/podman/machine/init.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2022-04-21 17:03:45 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2022-04-21 17:05:16 -0400
commitcc3790f332d989440eb1720e24e3619fc97c74ee (patch)
treef3861d4c3d17a7e9d0291a6f3288d6f9a411e373 /cmd/podman/machine/init.go
parentbdbd477c286b8bcf27a498d0f8b0e8ba7642a018 (diff)
downloadpodman-cc3790f332d989440eb1720e24e3619fc97c74ee.tar.gz
podman-cc3790f332d989440eb1720e24e3619fc97c74ee.tar.bz2
podman-cc3790f332d989440eb1720e24e3619fc97c74ee.zip
Switch all rootful to rootfull
We are inconsistent on the name, we should stick with rootfull. [NO NEW TESTS NEEDED] Existing tests should handle this and no tests for machines exists yet. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman/machine/init.go')
-rw-r--r--cmd/podman/machine/init.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/cmd/podman/machine/init.go b/cmd/podman/machine/init.go
index 2d0afbf05..06c1f7248 100644
--- a/cmd/podman/machine/init.go
+++ b/cmd/podman/machine/init.go
@@ -12,6 +12,7 @@ import (
"github.com/containers/podman/v4/pkg/machine"
"github.com/pkg/errors"
"github.com/spf13/cobra"
+ "github.com/spf13/pflag"
)
var (
@@ -106,8 +107,18 @@ func init() {
flags.StringVar(&initOpts.IgnitionPath, IgnitionPathFlagName, "", "Path to ignition file")
_ = initCmd.RegisterFlagCompletionFunc(IgnitionPathFlagName, completion.AutocompleteDefault)
- rootfulFlagName := "rootful"
- flags.BoolVar(&initOpts.Rootful, rootfulFlagName, false, "Whether this machine should prefer rootful container execution")
+ rootfullFlagName := "rootfull"
+ flags.BoolVar(&initOpts.Rootfull, rootfullFlagName, false, "Whether this machine should prefer rootfull container execution")
+ flags.SetNormalizeFunc(aliasFlags)
+}
+
+// aliasFlags is a function to handle backwards compatibility with old flags
+func aliasFlags(f *pflag.FlagSet, name string) pflag.NormalizedName {
+ switch name {
+ case "rootful":
+ name = "rootfull"
+ }
+ return pflag.NormalizedName(name)
}
// TODO should we allow for a users to append to the qemu cmdline?