lib/kitchen/driver/vagrant.rb in kitchen-vagrant-0.10.0 vs lib/kitchen/driver/vagrant.rb in kitchen-vagrant-0.11.0

- old
+ new

@@ -32,12 +32,18 @@ # # @todo Vagrant installation check and version will be placed into any # dependency hook checks when feature is released class Vagrant < Kitchen::Driver::SSHBase - default_config :customize, {:memory => '256'} + default_config :customize, { :memory => '256' } default_config :synced_folders, {} + default_config :box do |driver| + driver.default_values("box") + end + default_config :box_url do |driver| + driver.default_values("box_url") + end required_config :box no_parallel_for :create, :destroy @@ -50,18 +56,14 @@ info("Vagrant instance #{instance.to_str} created.") end def converge(state) create_vagrantfile - ssh_args = build_ssh_args(state) - install_omnibus(ssh_args) if config[:require_chef_omnibus] if config[:use_vagrant_provision] run "vagrant provision" else - prepare_chef_home(ssh_args) - upload_chef_data(ssh_args) - run_chef_solo(ssh_args) + super end end def setup(state) create_vagrantfile @@ -87,13 +89,35 @@ def verify_dependencies check_vagrant_version check_berkshelf_plugin if config[:use_vagrant_berkshelf_plugin] end + def default_values(value) + (default_boxes[instance.platform.name] || Hash.new)[value] + end + protected WEBSITE = "http://downloads.vagrantup.com/" MIN_VER = "1.1.0" + OMNITRUCK_PREFIX = "https://opscode-vm-bento.s3.amazonaws.com/vagrant" + PLATFORMS = %w{ + ubuntu-10.04 ubuntu-12.04 ubuntu-12.10 ubuntu-13.04 + centos-6.4 centos-5.9 debian-7.1.0 + } + + def default_boxes + @default_boxes ||= begin + hash = Hash.new + PLATFORMS.each do |platform| + hash[platform] = Hash.new + hash[platform]["box"] = "opscode-#{platform}" + hash[platform]["box_url"] = + "#{OMNITRUCK_PREFIX}/opscode_#{platform}_provisionerless.box" + end + hash + end + end def run(cmd, options = {}) cmd = "echo #{cmd}" if config[:dry_run] run_command(cmd, { :cwd => vagrant_root }.merge(options)) end