chef-boneyard / chef-provisioning-vagrant

Vagrant provisioner for chef-provisioning
Apache License 2.0
22 stars 24 forks source link

Need ability to specify vm.synced_folder settings in vagrant_options #48

Open steversmith opened 7 years ago

steversmith commented 7 years ago

If I include a vm.synced_folder setting in vagrant_options, then the resulting vagrant file is invalid, which causes vagrant up to fail.

Example:

The following recipe:

options = {
  vagrant_options: {
    'vm.box' => 'redhat',
    'vm.synced_folder' => ['",", "/vagrant", disabled: true']
  }
}

machine 'somemachine' do
  driver 'vagrant'
  machine_options options
end

Produces the following vagrant file, which causes vagrant to fail:

Vagrant.configure('2') do |outer_config|
  outer_config.vm.define "somemachine" do |config|
    config.vm.box = "redhat"
    config.vm.synced_folder = ["\",\", \"/vagrant\", disabled: true"]
    config.vm.hostname = "somemachine"
  end
end

The error message from running the recipe:

Error executing action `converge` on resource 'machine[somemachine]'

RuntimeError
------------
vagrant up somemachine --provider virtualbox failed!
STDOUT:Bringing machine 'somemachine' up with 'virtualbox' provider...

STDERR:There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* The following settings shouldn't exist: synced_folder
steversmith commented 7 years ago

The desired vagrantfile would look like this:

Vagrant.configure('2') do |outer_config|
  outer_config.vm.define "somemachine" do |config|
    config.vm.box = "redhat"
    config.vm.synced_folder(",", "/vagrant", disabled: true)
    config.vm.hostname = "somemachine"
  end
end

A possible fix is to handle the vm.synced_folder setting key in same way as the vm.network setting key