vagrant 0.6.9 → 0.7.0.beta

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 0.7.0.beta (December 24, 2010)
2
+
3
+ - VirtualBox 4.0 support. Support for VirtualBox 3.2 is _dropped_, since
4
+ the API is so different. Stay with the 0.6.x series if you have VirtualBox
5
+ 3.2.x.
6
+ - Changed the unused host only network destroy mechanism to check for
7
+ uselessness after the VM is destroyed. This should result in more accurate
8
+ checks.
9
+ - Networks are no longer disabled upon halt/destroy. With the above
10
+ change, its unnecessary.
11
+
1
12
  ## 0.6.9 (December 21, 2010)
2
13
 
3
14
  - Puppet provisioner. [GH-223]
data/README.md CHANGED
@@ -54,3 +54,8 @@ be installed with a simple `gem install bundler --pre`. Afterwords, do the follo
54
54
  rake
55
55
 
56
56
  This will run the test suite, which should come back all green! Then you're good to go!
57
+
58
+ If you want to run Vagrant without having to install the gem, you may use `bundle exec`,
59
+ like so:
60
+
61
+ bundle exec bin/vagrant help
@@ -30,7 +30,6 @@ module Vagrant
30
30
  register(:halt, Builder.new do
31
31
  use VM::DiscardState
32
32
  use VM::Halt
33
- use VM::DisableNetworks
34
33
  end)
35
34
 
36
35
  # suspend - Suspends the VM
@@ -62,9 +61,9 @@ module Vagrant
62
61
  register(:destroy, Builder.new do
63
62
  use Action[:halt], :force => true
64
63
  use VM::ClearNFSExports
65
- use VM::DestroyUnusedNetworkInterfaces
66
64
  use VM::Destroy
67
65
  use VM::CleanMachineFolder
66
+ use VM::DestroyUnusedNetworkInterfaces
68
67
  end)
69
68
 
70
69
  # package - Export and package the VM
@@ -31,7 +31,7 @@ module Vagrant
31
31
  keep = Dir["#{f}/**/*"].find do |d|
32
32
  # Find a file that doesn't have ".xml-prev" as the suffix,
33
33
  # which signals that we want to keep this folder
34
- File.file?(d) && !(File.basename(d) =~ /\.xml-prev$/)
34
+ File.file?(d) && !(File.basename(d) =~ /\.vbox-prev$/)
35
35
  end
36
36
 
37
37
  FileUtils.rm_rf(f) if !keep
@@ -8,7 +8,7 @@ module Vagrant
8
8
 
9
9
  def call(env)
10
10
  env.ui.info I18n.t("vagrant.actions.vm.destroy.destroying")
11
- env["vm"].vm.destroy(:destroy_medium => :delete)
11
+ env["vm"].vm.destroy
12
12
  env["vm"].vm = nil
13
13
 
14
14
  @app.call(env)
@@ -9,20 +9,15 @@ module Vagrant
9
9
  end
10
10
 
11
11
  def call(env)
12
- # We need to check if the host only network specified by any
13
- # of the adapters would not have any more clients if it was
14
- # destroyed. And if so, then destroy the host only network
15
- # itself.
16
- interfaces = env["vm"].vm.network_adapters.collect do |adapter|
17
- adapter.host_interface_object
18
- end
12
+ # Destroy all the host only network adapters which are empty.
13
+ VirtualBox::Global.global(true).host.network_interfaces.each do |iface|
14
+ # We only care about host only interfaces
15
+ next if iface.interface_type != :host_only
19
16
 
20
- interfaces.compact.uniq.each do |interface|
21
- # Destroy the network interface if there is only one
22
- # attached VM (which must be this VM)
23
- if interface.attached_vms.length == 1
17
+ # Destroy it if there is nothing attached
18
+ if iface.attached_vms.empty?
24
19
  env.ui.info I18n.t("vagrant.actions.vm.destroy_network.destroying")
25
- interface.destroy
20
+ iface.destroy
26
21
  end
27
22
  end
28
23
 
@@ -32,7 +32,7 @@ module Vagrant
32
32
  def check_virtualbox!
33
33
  version = VirtualBox.version
34
34
  raise Errors::VirtualBoxNotDetected if version.nil?
35
- raise Errors::VirtualBoxInvalidVersion, :version => version.to_s if version.to_f < 3.2
35
+ raise Errors::VirtualBoxInvalidVersion, :version => version.to_s if version.to_f < 4.0
36
36
  raise Errors::VirtualBoxInvalidOSE, :version => version.to_s if version.to_s.downcase.include?("ose")
37
37
  rescue Errors::VirtualBoxNotDetected
38
38
  # On 64-bit Windows, show a special error. This error is a subclass
@@ -2,5 +2,5 @@ module Vagrant
2
2
  # This will always be up to date with the current version of Vagrant,
3
3
  # since it is used to generate the gemspec and is also the source of
4
4
  # the version for `vagrant -v`
5
- VERSION = "0.6.9"
5
+ VERSION = "0.7.0.beta"
6
6
  end
@@ -96,8 +96,13 @@ en:
96
96
  to continue.
97
97
  virtualbox_invalid_version: |-
98
98
  Vagrant has detected that you have VirtualBox version %{version} installed!
99
- Vagrant requires that you use at least VirtualBox version 3.2. Please install
99
+ Vagrant requires that you use at least VirtualBox version 4.0. Please install
100
100
  a more recent version of VirtualBox to continue.
101
+
102
+ The Vagrant 0.6.x series supports VirtualBox 3.2, so if you're stuck with that
103
+ version, then please use the 0.6.x series of Vagrant.
104
+
105
+ Any earlier versions of VirtualBox are completely unsupported. Please upgrade.
101
106
  virtualbox_not_detected: |-
102
107
  Vagrant could not detect VirtualBox! Make sure VirtualBox is properly installed.
103
108
  If VirtualBox is installed, it may be an incorrect version. Vagrant currently
@@ -37,10 +37,10 @@ class CleanMachineFolderVMActionTest < Test::Unit::TestCase
37
37
  @instance.clean_machine_folder
38
38
  end
39
39
 
40
- should "delete directories with only .xml-prev files" do
40
+ should "delete directories with only .vbox-prev files" do
41
41
  folders = {
42
- "sfoo" => %W[foo bar baz.xml-prev],
43
- "sbar" => %W[foo.xml-prev]
42
+ "sfoo" => %W[foo bar baz.vbox-prev],
43
+ "sbar" => %W[foo.vbox-prev]
44
44
  }
45
45
 
46
46
  Dir.expects(:[]).with(@folder).returns(folders.keys)
@@ -57,7 +57,7 @@ class CleanMachineFolderVMActionTest < Test::Unit::TestCase
57
57
  should "delete directories with only subdirectories" do
58
58
  folders = {
59
59
  "sfoo" => %W[foo bar],
60
- "sbar" => %W[foo.xml-prev]
60
+ "sbar" => %W[foo.vbox-prev]
61
61
  }
62
62
 
63
63
  File.stubs(:file?).returns(false)
@@ -77,6 +77,8 @@ class CleanMachineFolderVMActionTest < Test::Unit::TestCase
77
77
  should "do nothing if folder is < 10 characters" do
78
78
  VirtualBox::Global.global.system_properties.stubs(:default_machine_folder).returns("foo")
79
79
  Dir.expects(:[]).never
80
+
81
+ @instance.clean_machine_folder
80
82
  end
81
83
  end
82
84
  end
@@ -16,7 +16,7 @@ class DestroyVMActionTest < Test::Unit::TestCase
16
16
 
17
17
  context "destroying the VM" do
18
18
  should "destroy VM and attached images" do
19
- @internal_vm.expects(:destroy).with(:destroy_medium => :delete).once
19
+ @internal_vm.expects(:destroy).once
20
20
  @env["vm"].expects(:vm=).with(nil).once
21
21
  @app.expects(:call).with(@env).once
22
22
  @instance.call(@env)
@@ -16,24 +16,27 @@ class DestroyUnusedNetworkInterfacesVMActionTest < Test::Unit::TestCase
16
16
 
17
17
  context "calling" do
18
18
  setup do
19
- @network_adapters = []
20
- @internal_vm.stubs(:network_adapters).returns(@network_adapters)
19
+ @interfaces = []
20
+ global = mock("global")
21
+ host = mock("host")
22
+ VirtualBox::Global.stubs(:global).returns(global)
23
+ global.stubs(:host).returns(host)
24
+ host.stubs(:network_interfaces).returns(@interfaces)
21
25
  end
22
26
 
23
- def stub_interface(length=5)
27
+ def stub_interface(length=5, type=:host_only)
24
28
  interface = mock("interface")
25
- adapter = mock("adapter")
26
- adapter.stubs(:host_interface_object).returns(interface)
29
+ interface.stubs(:interface_type).returns(type)
27
30
  interface.stubs(:attached_vms).returns(Array.new(length))
28
31
 
29
- @network_adapters << adapter
32
+ @interfaces << interface
30
33
  interface
31
34
  end
32
35
 
33
36
  should "destroy only the unused network interfaces" do
34
37
  stub_interface(5)
35
38
  stub_interface(7)
36
- results = [stub_interface(1), stub_interface(1)]
39
+ results = [stub_interface(0), stub_interface(0)]
37
40
 
38
41
  results.each do |result|
39
42
  result.expects(:destroy).once
data/vagrant.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency "net-scp", "~> 1.0.3"
22
22
  s.add_dependency "i18n", "~> 0.4.1"
23
23
  s.add_dependency "thor", "~> 0.14.2"
24
- s.add_dependency "virtualbox", "~> 0.7.6"
24
+ s.add_dependency "virtualbox", "~> 0.8.0"
25
25
 
26
26
  s.add_development_dependency "rake"
27
27
  s.add_development_dependency "contest", ">= 0.1.2"
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ prerelease: true
5
5
  segments:
6
6
  - 0
7
- - 6
8
- - 9
9
- version: 0.6.9
7
+ - 7
8
+ - 0
9
+ - beta
10
+ version: 0.7.0.beta
10
11
  platform: ruby
11
12
  authors:
12
13
  - Mitchell Hashimoto
@@ -15,7 +16,7 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2010-12-21 00:00:00 -08:00
19
+ date: 2010-12-24 00:00:00 -08:00
19
20
  default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
@@ -147,9 +148,9 @@ dependencies:
147
148
  - !ruby/object:Gem::Version
148
149
  segments:
149
150
  - 0
150
- - 7
151
- - 6
152
- version: 0.7.6
151
+ - 8
152
+ - 0
153
+ version: 0.8.0
153
154
  type: :runtime
154
155
  prerelease: false
155
156
  version_requirements: *id009
@@ -254,7 +255,6 @@ files:
254
255
  - lib/vagrant/action/vm/customize.rb
255
256
  - lib/vagrant/action/vm/destroy.rb
256
257
  - lib/vagrant/action/vm/destroy_unused_network_interfaces.rb
257
- - lib/vagrant/action/vm/disable_networks.rb
258
258
  - lib/vagrant/action/vm/discard_state.rb
259
259
  - lib/vagrant/action/vm/export.rb
260
260
  - lib/vagrant/action/vm/forward_ports.rb
@@ -367,7 +367,6 @@ files:
367
367
  - test/vagrant/action/vm/customize_test.rb
368
368
  - test/vagrant/action/vm/destroy_test.rb
369
369
  - test/vagrant/action/vm/destroy_unused_network_interfaces_test.rb
370
- - test/vagrant/action/vm/disable_networks_test.rb
371
370
  - test/vagrant/action/vm/discard_state_test.rb
372
371
  - test/vagrant/action/vm/export_test.rb
373
372
  - test/vagrant/action/vm/forward_ports_helpers_test.rb
@@ -442,7 +441,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
442
441
  requirements:
443
442
  - - ">="
444
443
  - !ruby/object:Gem::Version
445
- hash: -1856094503640076459
444
+ hash: 1825032801895729631
446
445
  segments:
447
446
  - 0
448
447
  version: "0"
@@ -1,34 +0,0 @@
1
- module Vagrant
2
- class Action
3
- module VM
4
- # Middleware to disable all host only networks on the
5
- # VM
6
- class DisableNetworks
7
- def initialize(app, env)
8
- @app = app
9
- @env = env
10
- end
11
-
12
- def call(env)
13
- if env["vm"].created?
14
- logged = false
15
-
16
- env["vm"].vm.network_adapters.each do |adapter|
17
- next if adapter.attachment_type != :host_only
18
-
19
- if !logged
20
- env.ui.info I18n.t("vagrant.actions.vm.disable_networks.disabling")
21
- logged = true
22
- end
23
-
24
- adapter.enabled = false
25
- adapter.save
26
- end
27
- end
28
-
29
- @app.call(env)
30
- end
31
- end
32
- end
33
- end
34
- end
@@ -1,48 +0,0 @@
1
- require "test_helper"
2
-
3
- class DisableNetworksVMActionTest < Test::Unit::TestCase
4
- setup do
5
- @klass = Vagrant::Action::VM::DisableNetworks
6
- @app, @env = action_env
7
-
8
- @vm = mock("vm")
9
- @env.env.stubs(:vm).returns(@vm)
10
-
11
- @internal_vm = mock("internal")
12
- @vm.stubs(:created?).returns(true)
13
- @vm.stubs(:vm).returns(@internal_vm)
14
- @internal_vm.stubs(:network_adapters).returns([])
15
-
16
- @instance = @klass.new(@app, @env)
17
- end
18
-
19
- def mock_adapter(type)
20
- adapter = mock("adapter")
21
- adapter.stubs(:attachment_type).returns(type)
22
-
23
- if type == :host_only
24
- adapter.expects(:enabled=).with(false)
25
- adapter.expects(:save)
26
- end
27
-
28
- @internal_vm.network_adapters << adapter
29
- end
30
-
31
- should "do nothing if VM is not created" do
32
- @vm.stubs(:created?).returns(false)
33
- @vm.expects(:vm).never
34
-
35
- @app.expects(:call).with(@env).once
36
- @instance.call(@env)
37
- end
38
-
39
- should "remove all network adapters and continue chain" do
40
- mock_adapter(:bridged)
41
- mock_adapter(:host_only)
42
- mock_adapter(:host_only)
43
-
44
- @app.expects(:call).with(@env).once
45
-
46
- @instance.call(@env)
47
- end
48
- end