We have a rather complicated chef setup which involves some per-developer settings loaded from a file being passed through to chef in the vagrantfile.
Is there a way for us to abort Vagrant if certain conditions are not met, and display a nice error message.
Currently we just throw an exception, but this causes a stacktrace, so if your terminal isn't big enough the message will be lost off the top.
There is no clean way to do this that Vagrant offers but since the Vagrantfile is Ruby, you can simply print a message and exit, couldn't you?
Good point!
Since this was the top Google result for the topic, to make it explicit, something like this should suffice:
if !Vagrant.has_plugin?('vagrant-vbguest')
puts 'vagrant-vbguest plugin required. To install simply do `vagrant plugin install vagrant-vbguest`'
abort
end
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
Since this was the top Google result for the topic, to make it explicit, something like this should suffice: