mitchellh/vagrant — pull request #1592 by justincampbell (2013-04-12 18:20:17+00:00)
Title: Load required chef_client options from Knife config

Adds a chef_config/knife method to both chef solo and chef client provisioners, which returns a hash with symbolized keys. For instance, I have a file at `~/.chef/knife.rb`, which I think looks like most user's Knife config:

```rb
current_dir = File.dirname(__FILE__)
validation_key "#{current_dir}/justincampbell-validator.pem"
chef_server_url "https://api.opscode.com/organizations/justincampbell"
```

This causes `knife` to return a hash of:

```rb
{
:validation_key => "~/.chef/justincampbell-validator.pem",
:chef_server_url => "https://api.opscode.com/organizations/justincampbell"
}
```

You can now omit these options in a `:chef_client` provisioner block:

```rb
config.vm.provision :chef_client do |chef|
chef.run_list = ["recipe[my_cookbook::default]"]
end
```

You could potentially also use knife[:key] in your Vagrantfile.