mitchellh/vagrant — pull request #556 by jbrown (2011-11-12 20:55:00+00:00)
Title: Remove the chef dependency on the default 'v-root' shared folder.

My vagrant box does not have the guest additions installed (on purpose), I plan to solely use NFS. So right away I have to override the defaults by doing something something like this:

```ruby
config.vm.share_folder "v-root", "/vagrant", ".", nfs: true
```

This is fine for a simple `Vagrantfile`. However, my `Vagrantfile` has become increasingly complex. I won't bore you with all the details but I am dynamically creating shared folders like so:

```ruby
Vagrant::Config.run do |config|
# ...

# Use NFS to mount your local checkouts on the machine.
projects.each do |project|
project_config = config.send(project)
config.vm.share_folder project.to_s, project_config.dir, project_config.local_dir, nfs: true
end

# ...
end
```

Each project is in a subdirectory of the directory containing the `Vagrantfile`.

```bash
$ ls
project_1
project_2
project_3
Vagrantfile
```

The projects are all shared to different directories on the guest so I don't want the `v-root` shared folder anymore. Plus NFS won't let you share a subdirectory of a directory that is already shared. To accomplish that I just add the following to my `Vagrantfile`.

```ruby
# Undo default vagrant config
config.vm.shared_folders.delete "v-root"
```

After you do this it blows up because `Vagrant::Provisioners::Chef#setup_json` expects the `v-root` shared folder to exist.

This pull request modifies `Vagrant::Provisioners::Chef#setup_json` so it will pass the directory to chef **only if** the `v-root` shared folder exists. There was also a stray comma in the initial code. ;-)