Skip to content
This repository has been archived by the owner on Jul 6, 2018. It is now read-only.

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

Open
steversmith opened this issue Mar 21, 2017 · 1 comment
Open

Comments

@steversmith
Copy link
Contributor

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
Copy link
Contributor Author

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

  • in lib/chef/provisioning/vagrant_driver/driver.rb
  • in the create_vm_file method
    • change if key == 'vm.network'
    • to if key == 'vm.network' || key=='vm.synced_folder'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant