templates/Vagrantfile.erb in kitchen-vagrant-0.15.0 vs templates/Vagrantfile.erb in kitchen-vagrant-0.16.0

- old
+ new

@@ -1,21 +1,49 @@ +<% config[:vagrantfiles].each do |vagrantfile| %> +require "<%= vagrantfile %>" +<% end %> + Vagrant.configure("2") do |c| + c.berkshelf.enabled = false if Vagrant.has_plugin?("vagrant-berkshelf") c.vm.box = "<%= config[:box] %>" + +<% if config[:box_url] %> c.vm.box_url = "<%= config[:box_url] %>" +<% end %> +<% if config[:box_version] %> + c.vm.box_version = "<%= config[:box_version] %>" +<% end %> + +<% if config[:box_check_update] %> + c.vm.box_check_update = "<%= config[:box_check_update] %>" +<% end %> + <% if config[:vm_hostname] %> c.vm.hostname = "<%= config[:vm_hostname] %>" <% end %> + +<% if config[:communicator] %> + c.vm.communicator = "<%= config[:communicator] %>" +<% end %> + <% if config[:guest] %> - c.vm.guest = <%= config[:guest] %> + c.vm.guest = "<%= config[:guest] %>" <% end %> + <% if config[:username] %> c.ssh.username = "<%= config[:username] %>" <% end %> +<% if config[:password] %> + c.ssh.password = "<%= config[:password] %>" +<% end %> <% if config[:ssh_key] %> c.ssh.private_key_path = "<%= config[:ssh_key] %>" <% end %> +<% config[:ssh].each do |key, value| %> + c.ssh.<%= key %> = <%= value %> +<% end %> <% Array(config[:network]).each do |opts| %> c.vm.network(:<%= opts[0] %>, <%= opts[1..-1].join(", ") %>) <% end %> @@ -23,15 +51,47 @@ <% config[:synced_folders].each do |source, destination, options| %> c.vm.synced_folder "<%= source %>", "<%= destination %>", <%= options %> <% end %> c.vm.provider :<%= config[:provider] %> do |p| +<% case config[:provider] + when "virtualbox", /^vmware_/ + if config[:gui] == true || config[:gui] == false %> + p.gui = <%= config[:gui] %> +<% end + end %> <% config[:customize].each do |key, value| %> <% case config[:provider] - when "virtualbox" %> - p.customize ["modifyvm", :id, "--<%= key %>", "<%= value %>"] - <% when "rackspace", "softlayer" %> + when "libvirt" %> + p.<%= key %> = <%= value%> + <% when "lxc" %> + <% if key == :container_name %> + p.container_name = <%= value == ":machine" ? value : "\"#{value}\"" %> + <% elsif key == :backingstore %> + p.backingstore = "<%= value %>" + <% elsif key == :backingstore_options %> + <% config[:customize][:backingstore_options].each do |opt, opt_val| %> + p.backingstore_option "--<%= opt %>", "<%= opt_val %>" + <% end %> + <% else %> + p.customize "<%= key %>", "<%= value %>" + <% end %> + <% when "managed" %> + <% if key == :server %> + p.server = "<%= value %>" + <% end %> + <% when "parallels" %> + p.customize ["set", :id, "--<%= key.to_s.gsub('_', '-') %>", "<%= value %>"] + <% when "rackspace" %> p.<%= key %> = "<%= value%>" + <% when "softlayer" %> + <% if key == :disk_capacity %> + p.<%= key %> = <%= value %> + <% else %> + p.<%= key %> = "<%= value %>" + <% end %> + <% when "virtualbox" %> + p.customize ["modifyvm", :id, "--<%= key %>", "<%= value %>"] <% when /^vmware_/ %> <% if key == :memory %> <% unless config[:customize].include?(:memsize) %> p.vmx["memsize"] = "<%= value %>" <% end %>