mirror of
https://github.com/containers/podman.git
synced 2025-06-24 03:08:13 +08:00
Merge pull request #13466 from baude/machinermf
machine rm -f stops and removes machine
This commit is contained in:
@ -37,7 +37,7 @@ func init() {
|
|||||||
|
|
||||||
flags := rmCmd.Flags()
|
flags := rmCmd.Flags()
|
||||||
formatFlagName := "force"
|
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"
|
keysFlagName := "save-keys"
|
||||||
flags.BoolVar(&destoryOptions.SaveKeys, keysFlagName, false, "Do not delete SSH 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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
confirmationMessage, remove, err := vm.Remove(vmName, machine.RemoveOptions{})
|
confirmationMessage, remove, err := vm.Remove(vmName, destoryOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,9 @@ is used.
|
|||||||
|
|
||||||
Print usage statement.
|
Print usage statement.
|
||||||
|
|
||||||
#### **--force**
|
#### **--force**, **-f**
|
||||||
|
|
||||||
Delete without confirmation
|
Stop and delete without confirmation
|
||||||
|
|
||||||
#### **--save-ignition**
|
#### **--save-ignition**
|
||||||
|
|
||||||
@ -58,6 +58,10 @@ The following files will be deleted:
|
|||||||
Are you sure you want to continue? [y/N] y
|
Are you sure you want to continue? [y/N] y
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
$ podman machine rm -f test1
|
||||||
|
$
|
||||||
|
```
|
||||||
## SEE ALSO
|
## SEE ALSO
|
||||||
**[podman(1)](podman.1.md)**, **[podman-machine(1)](podman-machine.1.md)**
|
**[podman(1)](podman.1.md)**, **[podman-machine(1)](podman-machine.1.md)**
|
||||||
|
|
||||||
|
@ -679,7 +679,7 @@ func (v *MachineVM) Remove(name string, opts machine.RemoveOptions) (string, fun
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", nil, err
|
return "", nil, err
|
||||||
}
|
}
|
||||||
if running {
|
if running && !opts.Force {
|
||||||
return "", nil, errors.Errorf("running vm %q cannot be destroyed", v.Name)
|
return "", nil, errors.Errorf("running vm %q cannot be destroyed", v.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user