templates/Vagrantfile.erb in kitchen-vagrant-0.21.1 vs templates/Vagrantfile.erb in kitchen-vagrant-1.0.0

- old
+ new

@@ -2,10 +2,16 @@ require "<%= vagrantfile %>" <% end %> Vagrant.configure("2") do |c| c.berkshelf.enabled = false if Vagrant.has_plugin?("vagrant-berkshelf") + <% if config[:cachier] %> + if Vagrant.has_plugin?("vagrant-cachier") + c.cache.scope = <%= [':box', ':machine'].include?(config[:cachier]) ? config[:cachier] : ':box' %> + end + <% end %> + c.vm.box = "<%= config[:box] %>" <% if config[:box_url] %> c.vm.box_url = "<%= config[:box_url] %>" <% end %> @@ -13,13 +19,17 @@ <% if config[:box_version] %> c.vm.box_version = "<%= config[:box_version] %>" <% end %> <% if !config[:box_check_update].nil? %> - c.vm.box_check_update = "<%= config[:box_check_update] %>" + c.vm.box_check_update = <%= config[:box_check_update] %> <% end %> +<% if !config[:box_download_ca_cert].nil? %> + c.vm.box_download_ca_cert = "<%= config[:box_download_ca_cert] %>" +<% end %> + <% if !config[:box_download_insecure].nil? %> c.vm.box_download_insecure = "<%= config[:box_download_insecure] %>" <% end %> <% if config[:vm_hostname] %> @@ -91,24 +101,38 @@ end %> <% config[:customize].each do |key, value| %> <% case config[:provider] when "libvirt" %> - <% if value.is_a? String %> + <% if key == :storage %> + <% if value.is_a? String %> + p.storage <%= value %> + <% elsif value.is_a? Array %> + <% value.each do |v| %> + p.storage <%= v %> + <% end %> + <% end %> + <% else %> + <% if value.is_a? String %> p.<%= key %> = "<%= value%>" - <% else %> + <% else %> p.<%= key %> = <%= value%> - <% end %> + <% end %> + <% end %> <% 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 %> + <% elsif key == :include %> + <% Array(value).each do |include| %> + p.customize "<%= key %>", "<%= include %>" + <% end %> <% else %> p.customize "<%= key %>", "<%= value %>" <% end %> <% when "managed" %> <% if key == :server %> @@ -118,20 +142,39 @@ <% if key == :memory || key == :cpus %> p.<%= key %> = <%= value %> <% else %> p.customize ["set", :id, "--<%= key.to_s.gsub('_', '-') %>", "<%= value %>"] <% end %> - <% when "rackspace" %> - p.<%= key %> = "<%= value%>" <% when "softlayer" %> <% if key == :disk_capacity %> p.<%= key %> = <%= value %> <% else %> p.<%= key %> = "<%= value %>" <% end %> <% when "virtualbox" %> + <% if key == :createhd %> + p.customize ["createhd", "--filename", "<%= value[:filename] %>", "--size", <%= value[:size] %>] + <% elsif key == :storageattach %> + <% options = [] %> + <% value.each do |storageattach_option_key, storageattach_option_value| + options << "\"--#{storageattach_option_key}\"" + if storageattach_option_value.instance_of? Fixnum + options << storageattach_option_value + else + options << "\"#{storageattach_option_value}\"" + end + end %> + p.customize ["storageattach", :id, <%= options.join(', ') %>] + <% elsif key == :cpuidset %> + <% ids = [] %> + <% value.each do | id | + ids << "\"#{id}\"" + end %> + p.customize ["modifyvm", :id, "--cpuidset", <%= ids.join(', ') %>] + <% else %> p.customize ["modifyvm", :id, "--<%= key %>", "<%= value %>"] + <% end %> <% when /^vmware_/ %> <% if key == :memory %> <% unless config[:customize].include?(:memsize) %> p.vmx["memsize"] = "<%= value %>" <% end %> @@ -140,10 +183,10 @@ p.vmx["numvcpus"] = "<%= value %>" <% end %> <% else %> p.vmx["<%= key %>"] = "<%= value %>" <% end %> - <% when "openstack", "cloudstack", "hyperv", "ovirt3" %> + <% when "openstack", "cloudstack", "hyperv", "ovirt3", "rackspace", "aws" %> <% if value.is_a? String %> p.<%= key %> = "<%= value%>" <% else %> p.<%= key %> = <%= value%> <% end %>