mirror of
https://github.com/containers/podman.git
synced 2025-09-28 17:25:31 +08:00
Use machine image as specified in containers.conf
For podman machine init, deprecate the --image-path option for --image. --image now accepts the correct image from containers.conf Also, add the ability to specify an OCI image from the --image flag using the docker:// transport. Signed-off-by: Ashley Cui <acui@redhat.com>
This commit is contained in:
@ -14,6 +14,7 @@ import (
|
||||
"github.com/containers/podman/v5/pkg/machine/define"
|
||||
"github.com/containers/podman/v5/pkg/machine/shim"
|
||||
"github.com/containers/podman/v5/pkg/machine/vmconfigs"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@ -101,9 +102,17 @@ func init() {
|
||||
flags.StringVar(&initOpts.Username, UsernameFlagName, cfg.ContainersConfDefaultsRO.Machine.User, "Username used in image")
|
||||
_ = initCmd.RegisterFlagCompletionFunc(UsernameFlagName, completion.AutocompleteDefault)
|
||||
|
||||
ImageFlagName := "image"
|
||||
flags.StringVar(&initOpts.Image, ImageFlagName, cfg.ContainersConfDefaultsRO.Machine.Image, "Bootable image for machine")
|
||||
_ = initCmd.RegisterFlagCompletionFunc(ImageFlagName, completion.AutocompleteDefault)
|
||||
|
||||
// Deprecate image-path option, use --image instead
|
||||
ImagePathFlagName := "image-path"
|
||||
flags.StringVar(&initOpts.ImagePath, ImagePathFlagName, "", "Path to bootable image")
|
||||
flags.StringVar(&initOpts.Image, ImagePathFlagName, cfg.ContainersConfDefaultsRO.Machine.Image, "Bootable image for machine")
|
||||
_ = initCmd.RegisterFlagCompletionFunc(ImagePathFlagName, completion.AutocompleteDefault)
|
||||
if err := flags.MarkDeprecated(ImagePathFlagName, "use --image instead"); err != nil {
|
||||
logrus.Error("unable to mark image-path flag deprecated")
|
||||
}
|
||||
|
||||
VolumeFlagName := "volume"
|
||||
flags.StringArrayVarP(&initOpts.Volumes, VolumeFlagName, "v", cfg.ContainersConfDefaultsRO.Machine.Volumes.Get(), "Volumes to mount, source:target")
|
||||
|
Reference in New Issue
Block a user