vagrantup 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8ea6a6067ea47a7a41dbaaf1d2c46022a62d93f1
4
- data.tar.gz: 1a8fa88abdbe29219036748e01625219e131c733
3
+ metadata.gz: b3f55a41c8818cd78ae275e7755838cb54375a8e
4
+ data.tar.gz: 2dd0a87ab3f2499af68d4debc63282e9c9e3fdf1
5
5
  SHA512:
6
- metadata.gz: a7c88a9f8f64f300cce12e99b0d7a200600d9353ef3152a5290df700953e09f29c4c09bd45eabb8c371384bcc17723633d7611e872bac348650d4f06e8769946
7
- data.tar.gz: 09700470893e3818779b7c9731d7c7918c0b39fd6107665c90df17c2ff32d4be59613c3136b617ece0ed74e98f9f4ebcc5be9e31efce4e2dfcdbb847c3055891
6
+ metadata.gz: f6ed42e61afc3539cc53458b7548ab2d694c475f2d6d39fab91c3c49d50bf51a26e96fc3e891498b0f0c2faf75d4ca24ff9d3c61358cf33b10ae83dd21355a46
7
+ data.tar.gz: 533db5d2cece10ab0026a8eb9fa9774f8cbeba092faa67488e31f688b9624fb7ce2c9761ff218a626d17ddfa0543ad7e024748dab6f5b6f0cea72b01cddaa48c
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -15,6 +15,7 @@ module Vagrant
15
15
 
16
16
  @runner.add_action(Download)
17
17
  @runner.add_action(Unpackage)
18
+ @runner.add_action(Verify)
18
19
  end
19
20
  end
20
21
  end
@@ -4,7 +4,6 @@ module Vagrant
4
4
  # This action unpackages a downloaded box file into its final
5
5
  # box destination within the vagrant home folder.
6
6
  class Unpackage < Base
7
-
8
7
  def execute!
9
8
  @runner.invoke_around_callback(:unpackage) do
10
9
  setup_box_dir
@@ -0,0 +1,32 @@
1
+ module Vagrant
2
+ module Actions
3
+ module Box
4
+ # This action verifies that a given box is valid. This works by attempting
5
+ # to read/interpret the appliance file (OVF). If the reading succeeds, then
6
+ # the box is assumed to be valid.
7
+ class Verify < Base
8
+ def execute!
9
+ logger.info "Verifying box..."
10
+ reload_configuration
11
+ verify_appliance
12
+ end
13
+
14
+ def reload_configuration
15
+ # We have to reload the environment config since we _just_ added the
16
+ # box. We do this by setting the current box to the recently added box,
17
+ # then reloading
18
+ @runner.env.config.vm.box = @runner.name
19
+ @runner.env.load_box!
20
+ @runner.env.load_config!
21
+ end
22
+
23
+ def verify_appliance
24
+ # We now try to read the applince. If it succeeds, we return true.
25
+ VirtualBox::Appliance.new(@runner.ovf_file)
26
+ rescue VirtualBox::Exceptions::FileErrorException
27
+ raise ActionException.new(:box_verification_failed)
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -11,6 +11,13 @@ module Vagrant
11
11
  @runner.add_action(action_klass)
12
12
  end
13
13
  end
14
+
15
+ def after_halt
16
+ # This sleep is here to allow the VM to clean itself up. There appears
17
+ # nothing [obvious] in the VirtualBox API to automate this. For now, this
18
+ # is an interim solution.
19
+ sleep 1
20
+ end
14
21
  end
15
22
  end
16
23
  end
@@ -126,7 +126,7 @@ module Vagrant
126
126
  #
127
127
  # @return [String]
128
128
  def ovf_file
129
- File.join(directory, Vagrant.config.vm.box_ovf)
129
+ File.join(directory, env.config.vm.box_ovf)
130
130
  end
131
131
 
132
132
  # Begins the process of adding a box to the vagrant installation. This
@@ -21,7 +21,7 @@ module Vagrant
21
21
  rootfile_path = File.join(Dir.pwd, Environment::ROOTFILE_NAME)
22
22
  error_and_exit(:rootfile_already_exists) if File.exist?(rootfile_path)
23
23
 
24
- # Copy over the rootfile template into this directory
24
+ # Write the rootfile
25
25
  default_box ||= "base"
26
26
  File.open(rootfile_path, 'w+') do |f|
27
27
  f.write(TemplateRenderer.render(Environment::ROOTFILE_NAME, :default_box => default_box))
@@ -37,6 +37,8 @@ module Vagrant
37
37
  error_and_exit(:virtualbox_not_detected)
38
38
  elsif version.to_f < 3.1
39
39
  error_and_exit(:virtualbox_invalid_version, :version => version.to_s)
40
+ elsif version.to_s.downcase.include?("ose")
41
+ error_and_exit(:virtualbox_invalid_ose, :version => version.to_s)
40
42
  end
41
43
  end
42
44
  end
@@ -17,6 +17,9 @@
17
17
 
18
18
  The box must be added through the `vagrant box add` command. Please view
19
19
  the documentation associated with the command for more information.
20
+ :box_verification_failed: |-
21
+ The specified box is invalid. This can commonly be attributed to incorrectly
22
+ typing in the path to the box or invalid packaging of the box.
20
23
  :box_not_specified: |-
21
24
  No base box was specified! A base box is required as a staring point
22
25
  for every vagrant virtual machine. Please specify one in your Vagrantfile
@@ -115,6 +118,11 @@
115
118
  Vagrant could not detect VirtualBox! Make sure VirtualBox is properly installed.
116
119
  If VirtualBox is installed, it may be an incorrect version. Vagrant currently
117
120
  only supports VirtualBox 3.1.x. Please install the proper version to continue.
121
+ :virtualbox_invalid_ose: |-
122
+ Vagrant has detected you're using an OSE ("Open Source Edition") of VirtualBox.
123
+ Vagrant currently doesn't support any of the OSE editions due to slight API
124
+ differences. Please download the regular package from virtualbox.org and install
125
+ to continue.
118
126
  :vm_failed_to_boot: |-
119
127
  Failed to connect to VM! Failed to boot?
120
128
  :vm_base_not_found: |-
@@ -7,7 +7,7 @@ class AddBoxActionTest < Test::Unit::TestCase
7
7
 
8
8
  context "prepare" do
9
9
  setup do
10
- @default_order = [Vagrant::Actions::Box::Download, Vagrant::Actions::Box::Unpackage]
10
+ @default_order = [Vagrant::Actions::Box::Download, Vagrant::Actions::Box::Unpackage, Vagrant::Actions::Box::Verify]
11
11
  @runner.stubs(:directory).returns("foo")
12
12
  File.stubs(:exists?).returns(false)
13
13
  end
@@ -0,0 +1,44 @@
1
+ require File.join(File.dirname(__FILE__), '..', '..', '..', 'test_helper')
2
+
3
+ class VerifyBoxActionTest < Test::Unit::TestCase
4
+ setup do
5
+ @runner, @vm, @action = mock_action(Vagrant::Actions::Box::Verify)
6
+ @runner.stubs(:name).returns("foo")
7
+ @runner.stubs(:temp_path).returns("bar")
8
+ end
9
+
10
+ context "executing" do
11
+ should "execute the proper actions in the proper order" do
12
+ exec_seq = sequence("exec_seq")
13
+ @action.expects(:reload_configuration).in_sequence(exec_seq)
14
+ @action.expects(:verify_appliance).in_sequence(exec_seq)
15
+ @action.execute!
16
+ end
17
+ end
18
+
19
+ context "reloading configuration" do
20
+ should "set the new box, load box, then load config" do
21
+ reload_seq = sequence("reload_seq")
22
+ @runner.env.config.vm.expects(:box=).with(@runner.name).in_sequence(reload_seq)
23
+ @runner.env.expects(:load_box!).in_sequence(reload_seq)
24
+ @runner.env.expects(:load_config!).in_sequence(reload_seq)
25
+ @action.reload_configuration
26
+ end
27
+ end
28
+
29
+ context "verifying appliance" do
30
+ setup do
31
+ @runner.stubs(:ovf_file).returns("foo")
32
+ end
33
+
34
+ should "create new appliance and return true if succeeds" do
35
+ VirtualBox::Appliance.expects(:new).with(@runner.ovf_file)
36
+ assert_nothing_raised { @action.verify_appliance }
37
+ end
38
+
39
+ should "return false if an exception is raised" do
40
+ VirtualBox::Appliance.expects(:new).with(@runner.ovf_file).raises(VirtualBox::Exceptions::FileErrorException)
41
+ assert_raises(Vagrant::Actions::ActionException) { @action.verify_appliance }
42
+ end
43
+ end
44
+ end
@@ -112,6 +112,7 @@ class BoxTest < Test::Unit::TestCase
112
112
  context "instance methods" do
113
113
  setup do
114
114
  @box = Vagrant::Box.new
115
+ @box.env = mock_environment
115
116
  end
116
117
 
117
118
  should "execute the Add action when add is called" do
@@ -141,10 +142,12 @@ class BoxTest < Test::Unit::TestCase
141
142
  context "ovf file" do
142
143
  setup do
143
144
  @box.stubs(:directory).returns("foo")
145
+
146
+ @box.env.config.vm.box_ovf = "foo.ovf"
144
147
  end
145
148
 
146
149
  should "be the directory joined with the config ovf file" do
147
- assert_equal File.join(@box.directory, Vagrant.config.vm.box_ovf), @box.ovf_file
150
+ assert_equal File.join(@box.directory, @box.env.config.vm.box_ovf), @box.ovf_file
148
151
  end
149
152
  end
150
153
  end
@@ -24,6 +24,13 @@ class EnvironmentTest < Test::Unit::TestCase
24
24
  VirtualBox.expects(:version).returns(version)
25
25
  Vagrant::Environment.check_virtualbox!
26
26
  end
27
+
28
+ should "error and exit for OSE VirtualBox" do
29
+ version = "3.1.6_OSE"
30
+ Vagrant::Environment.expects(:error_and_exit).with(:virtualbox_invalid_ose, :version => version.to_s).once
31
+ VirtualBox.expects(:version).returns(version)
32
+ Vagrant::Environment.check_virtualbox!
33
+ end
27
34
  end
28
35
 
29
36
  context "class method load!" do
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{vagrantup}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mitchell Hashimoto", "John Bender"]
12
- s.date = %q{2010-04-15}
12
+ s.date = %q{2010-04-21}
13
13
  s.default_executable = %q{vagrant}
14
14
  s.description = %q{Vagrant is a tool for building and distributing virtualized development environments.}
15
15
  s.email = ["mitchell.hashimoto@gmail.com", "john.m.bender@gmail.com"]
@@ -38,6 +38,7 @@ Gem::Specification.new do |s|
38
38
  "lib/vagrant/actions/box/destroy.rb",
39
39
  "lib/vagrant/actions/box/download.rb",
40
40
  "lib/vagrant/actions/box/unpackage.rb",
41
+ "lib/vagrant/actions/box/verify.rb",
41
42
  "lib/vagrant/actions/collection.rb",
42
43
  "lib/vagrant/actions/runner.rb",
43
44
  "lib/vagrant/actions/vm/boot.rb",
@@ -107,6 +108,7 @@ Gem::Specification.new do |s|
107
108
  "test/vagrant/actions/box/destroy_test.rb",
108
109
  "test/vagrant/actions/box/download_test.rb",
109
110
  "test/vagrant/actions/box/unpackage_test.rb",
111
+ "test/vagrant/actions/box/verify_test.rb",
110
112
  "test/vagrant/actions/collection_test.rb",
111
113
  "test/vagrant/actions/runner_test.rb",
112
114
  "test/vagrant/actions/vm/boot_test.rb",
@@ -176,6 +178,7 @@ Gem::Specification.new do |s|
176
178
  "test/vagrant/actions/box/destroy_test.rb",
177
179
  "test/vagrant/actions/box/download_test.rb",
178
180
  "test/vagrant/actions/box/unpackage_test.rb",
181
+ "test/vagrant/actions/box/verify_test.rb",
179
182
  "test/vagrant/actions/collection_test.rb",
180
183
  "test/vagrant/actions/runner_test.rb",
181
184
  "test/vagrant/actions/vm/boot_test.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrantup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mitchell Hashimoto
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2010-04-15 00:00:00.000000000 Z
12
+ date: 2010-04-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: virtualbox
@@ -126,6 +126,7 @@ files:
126
126
  - lib/vagrant/actions/box/destroy.rb
127
127
  - lib/vagrant/actions/box/download.rb
128
128
  - lib/vagrant/actions/box/unpackage.rb
129
+ - lib/vagrant/actions/box/verify.rb
129
130
  - lib/vagrant/actions/collection.rb
130
131
  - lib/vagrant/actions/runner.rb
131
132
  - lib/vagrant/actions/vm/boot.rb
@@ -195,6 +196,7 @@ files:
195
196
  - test/vagrant/actions/box/destroy_test.rb
196
197
  - test/vagrant/actions/box/download_test.rb
197
198
  - test/vagrant/actions/box/unpackage_test.rb
199
+ - test/vagrant/actions/box/verify_test.rb
198
200
  - test/vagrant/actions/collection_test.rb
199
201
  - test/vagrant/actions/runner_test.rb
200
202
  - test/vagrant/actions/vm/boot_test.rb
@@ -282,6 +284,7 @@ test_files:
282
284
  - test/vagrant/actions/box/destroy_test.rb
283
285
  - test/vagrant/actions/box/download_test.rb
284
286
  - test/vagrant/actions/box/unpackage_test.rb
287
+ - test/vagrant/actions/box/verify_test.rb
285
288
  - test/vagrant/actions/collection_test.rb
286
289
  - test/vagrant/actions/runner_test.rb
287
290
  - test/vagrant/actions/vm/boot_test.rb