hashicorp / vagrant

Vagrant is a tool for building and distributing development environments.
https://www.vagrantup.com
Other
26.25k stars 4.43k forks source link

Reveal the use-case of "default (ID: ...)" as part of output from 'vagrant box remove [name]' #11386

Closed Ricky-Tigg closed 10 months ago

Ricky-Tigg commented 4 years ago

Vagrant 2.2.6 Enhancement request: Reveal the use-case of mention default (ID: ...) as part of output from vagrant box remove [name]

Goal: to keep on my system an image file downloaded as result of vagrant up and to remove things set by Vagrant. I conceived those actions had to rely on executions of vagrant box remove [name] and vagrant destroy [name]. Order not specified in on-line documentation.

$ vagrant box remove --provider=libvirt fedora/31-cloud-base
Box 'fedora/31-cloud-base' (v31.20191023.0) with provider 'libvirt' appears
to still be in use by at least one Vagrant environment. Removing
the box could corrupt the environment. We recommend destroying
these environments first:

default (ID: fcbe0e358c464bbc8f08dc983a6c5211)
Are you sure you want to remove this box? [y/N] <Return key>

Actual result: It seemed to me that the presence of default (ID: ...) must have a purpose. Without further relevant instruction in the output from vagrant box remove [name], It always seem wiser having to rely on an elaborated documentation, defining 'vagrant destroy [name|id]' as syntax. Thus vagrant destroy [name] wasl executed.

Expected: To serve other users as well, an up-to-date instruction of that output, would be as model: "We recommend destroying these environments first, using command 'vagrant destroy [ID]' instead of the 'vagrant destroy [name]' command as well suggested as usable in documentation at https://www.vagrantup.com/docs/cli/destroy.html."

That aspect was reported first to Red Hat, i then: received a proper information about that use-case:

$ vagrant destroy fcbe0e358c464bbc8f08dc983a6c5211
    default: Are you sure you want to destroy the 'default' VM? [y/N] y
==> default: Removing domain...
briancain commented 4 years ago

Hey there @Ricky-Tigg ! Thanks for the detailed report.

The reason for the ID here is because that machine likely exists else where on disk, and trying to run destroy on the name would be invalid (or the wrong guest). So running destroy on the ID will make it work anywhere, and also help users identify which box it is if they check global-status.

I think putting too much information though in this message will be an overload of text, and explaining the use-case of why the ID is shown is too much additional information. Also generally I don't think placing documentation URLs in output is a good idea. It's easy for those to become stale and direct folks to dead URLs.

I'm happy though to improve the destroy documentation to explain the reasoning behind using the ID there instead of name. Thanks!