diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-03-09 03:51:55 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-09 03:51:55 -0500 |
commit | 3e870f8c8e3736e9c81473d45c8148d4de0e70c3 (patch) | |
tree | c17ad3b084e3f1124b59469957ab464375fc5976 | |
parent | 951c681efae8374858b0d93c05cbf902230a89b7 (diff) | |
parent | 5b51b42cc86d6fe394e13ae9dd91f2ddefdb543e (diff) | |
download | podman-3e870f8c8e3736e9c81473d45c8148d4de0e70c3.tar.gz podman-3e870f8c8e3736e9c81473d45c8148d4de0e70c3.tar.bz2 podman-3e870f8c8e3736e9c81473d45c8148d4de0e70c3.zip |
Merge pull request #13466 from baude/machinermf
machine rm -f stops and removes machine
-rw-r--r-- | cmd/podman/machine/rm.go | 4 | ||||
-rw-r--r-- | docs/source/markdown/podman-machine-rm.1.md | 8 | ||||
-rw-r--r-- | pkg/machine/qemu/machine.go | 2 |
3 files changed, 9 insertions, 5 deletions
diff --git a/cmd/podman/machine/rm.go b/cmd/podman/machine/rm.go index 38873084a..3e5d5fb0b 100644 --- a/cmd/podman/machine/rm.go +++ b/cmd/podman/machine/rm.go @@ -37,7 +37,7 @@ func init() { flags := rmCmd.Flags() formatFlagName := "force" - flags.BoolVar(&destoryOptions.Force, formatFlagName, false, "Do not prompt before rming") + flags.BoolVarP(&destoryOptions.Force, formatFlagName, "f", false, "Stop and do not prompt before rming") keysFlagName := "save-keys" flags.BoolVar(&destoryOptions.SaveKeys, keysFlagName, false, "Do not delete SSH keys") @@ -64,7 +64,7 @@ func rm(cmd *cobra.Command, args []string) error { if err != nil { return err } - confirmationMessage, remove, err := vm.Remove(vmName, machine.RemoveOptions{}) + confirmationMessage, remove, err := vm.Remove(vmName, destoryOptions) if err != nil { return err } diff --git a/docs/source/markdown/podman-machine-rm.1.md b/docs/source/markdown/podman-machine-rm.1.md index 7c9eb65c5..4eea1d2e4 100644 --- a/docs/source/markdown/podman-machine-rm.1.md +++ b/docs/source/markdown/podman-machine-rm.1.md @@ -23,9 +23,9 @@ is used. Print usage statement. -#### **--force** +#### **--force**, **-f** -Delete without confirmation +Stop and delete without confirmation #### **--save-ignition** @@ -58,6 +58,10 @@ The following files will be deleted: Are you sure you want to continue? [y/N] y ``` +``` +$ podman machine rm -f test1 +$ +``` ## SEE ALSO **[podman(1)](podman.1.md)**, **[podman-machine(1)](podman-machine.1.md)** diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go index 43a79dae8..92d8d1854 100644 --- a/pkg/machine/qemu/machine.go +++ b/pkg/machine/qemu/machine.go @@ -679,7 +679,7 @@ func (v *MachineVM) Remove(name string, opts machine.RemoveOptions) (string, fun if err != nil { return "", nil, err } - if running { + if running && !opts.Force { return "", nil, errors.Errorf("running vm %q cannot be destroyed", v.Name) } |