summaryrefslogtreecommitdiff
path: root/cmd/podman/machine/init.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/machine/init.go')
-rw-r--r--cmd/podman/machine/init.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/cmd/podman/machine/init.go b/cmd/podman/machine/init.go
index 8fb9f17c7..518e7490f 100644
--- a/cmd/podman/machine/init.go
+++ b/cmd/podman/machine/init.go
@@ -31,6 +31,10 @@ var (
now bool
)
+// maxMachineNameSize is set to thirty to limit huge machine names primarily
+// because macos has a much smaller file size limit.
+const maxMachineNameSize = 30
+
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
Command: initCmd,
@@ -83,7 +87,7 @@ func init() {
"reexec", false,
"process was rexeced",
)
- flags.MarkHidden("reexec")
+ _ = flags.MarkHidden("reexec")
ImagePathFlagName := "image-path"
flags.StringVar(&initOpts.ImagePath, ImagePathFlagName, cfg.Machine.Image, "Path to qcow image")
@@ -102,7 +106,7 @@ func init() {
_ = initCmd.RegisterFlagCompletionFunc(IgnitionPathFlagName, completion.AutocompleteDefault)
rootfulFlagName := "rootful"
- flags.BoolVar(&initOpts.Rootful, rootfulFlagName, false, "Whether this machine should prefer rootful container exectution")
+ flags.BoolVar(&initOpts.Rootful, rootfulFlagName, false, "Whether this machine should prefer rootful container execution")
}
// TODO should we allow for a users to append to the qemu cmdline?
@@ -111,10 +115,12 @@ func initMachine(cmd *cobra.Command, args []string) error {
vm machine.VM
err error
)
-
provider := getSystemDefaultProvider()
initOpts.Name = defaultMachineName
if len(args) > 0 {
+ if len(args[0]) > maxMachineNameSize {
+ return errors.New("machine name must be 30 characters or less")
+ }
initOpts.Name = args[0]
}
if _, err := provider.LoadVMByName(initOpts.Name); err == nil {