chef-provisioning-vagrant
chef-provisioning-vagrant copied to clipboard
machine_options is not preserved.
Hi,
I have the following code which cannot converge because the Vagrantfile is not correct
on the second convergence.
my_machine_options_for_virtualbox = <<-VC
config.vm.provider "virtualbox" do |v|
v.memory = "512"
v.cpus = "1"
end
config.vm.box = "opscode-centos-7.1"
config.vm.network "private_network", ip: "192.168.33.50"
VC
# Making machines converge 1 time
machine my-machine do
machine_options my_machine_options_for_virtualbox
recipe 'initialize'
end
# Convergence second time for 'setup' without machine_options
machine my-machine do
recipe 'setup'
end
On the second convergence, Chef modified the Vagrantfile, erased all the vagrant config in my_machine_options_for_virtualbox. So when reloading, it caused RuntimeError
RuntimeError ------------ vagrant reload my-machine failed! STDOUT: STDERR:There are errors in the configuration of this machine. Please fix the following errors and try again:
vm: * A box must be specified.