cassianoleal/vagrant-butcher — pull request #4 by pikesley (2013-02-20 13:13:00+00:00)
Title: Node destruction based on Chef node_name

The current implementation uses the Vagrant ```host_name``` as the target for its butchery. If this name differs from the Chef ```node_name```, it doesn't work properly. This PR allows a Vagrantfile like this:

```
# -*- mode: ruby -*-
Vagrant::Config.run do |config|

config.vm.define :odi do |odi_config|
odi_config.vm.host_name = "my-super-awesome-vagrant-node"
odi_config.vm.box = "precise64"
odi_config.vm.network :hostonly, "33.33.33.100"

odi_config.vm.provision :chef_client do |chef|
chef.node_name = "vagrant-%s" % [
ENV["USER"]
]
chef.chef_server_url = "https://chef.theodi.org"
chef.provisioning_path = "/etc/chef"
chef.knife_config = "./.chef/knife.rb"
chef.validation_client_name = "chef-validator"
chef.validation_key_path = ".chef/chef-validator.pem"
chef.run_list = chef.run_list = [
"recipe[nginx]"
]
end
end

end
```

So we now use the ```chef.node_name```, and ```vm.host_name``` can be anything you like (including empty). This suits our workflow much better.

I'm clearly going to run into grief when we get an ```ENV["USER"]``` clash, however, but that's a different problem...