vagrantup 0.9.99.1 → 0.9.99.2

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: 2e96062b6fdca98e03dead5bc15cb7bee039c360
4
- data.tar.gz: d22414b06f0fa20c534f940c7749420a458ac736
3
+ metadata.gz: 47114b7b4c12b0c9ef207c4c034e12c4ef7b3ec2
4
+ data.tar.gz: 8f5cd01bcb271539e179b0881163c4a22903ec19
5
5
  SHA512:
6
- metadata.gz: 205eb4b0eb766e9ca4487bbe2e1ef1bdf7ff86e74e780244b94a057b512aba5061023e689bf43e1fdbb72a4e2a8f62d66bc37052a882a33621c67d32159b1d8e
7
- data.tar.gz: 5316a1d824364e938bd798d082de4d3bd42c97afe66518d1957580f2f511f58f4df7f9235f9fb6488e618ad4f60b45f353c3d369bed913a92e12776219a4b348
6
+ metadata.gz: 9260b2fa40ee1037f5af1a2c19842484d0eb650fb020463585501e675d6d376b8318edb0ee3e9624097517eef7ff5b771cf82419d80e9afe1774abe2de0cfc7a
7
+ data.tar.gz: a57b9dc7b1c66954755f99863da37e1ac5bd91317b8c4f4fc6114801dd50bd1b7d5e4352a39a0978c0b3ccd792085f59403ce834959fa31936732ae3719fa6ba
data/CHANGELOG.md CHANGED
@@ -17,6 +17,16 @@
17
17
  - Unix-style line endings are used properly for guest OS. [GH-727]
18
18
  - Retry certain VirtualBox operations, since they intermittently fail.
19
19
  [GH-726]
20
+ - Fix issue where Vagrant would sometimes "lose" a VM if an exception
21
+ occurred. [GH-725]
22
+ - `vagrant destroy` destroys virtual machines in reverse order. [GH-739]
23
+ - Add an `fsid` option to Linux NFS exports. [GH-736]
24
+ - Fix edge case where an exception could be raised in networking code. [GH-742]
25
+ - Add missing translation for the "guru meditation" state. [GH-745]
26
+ - Check that VirtualBox exists before certain commands. [GH-746]
27
+ - NIC type can be defined for host-only network adapters. [GH-750]
28
+ - Fix issue where re-running chef-client would sometimes cause
29
+ problems due to file permissions. [GH-748]
20
30
 
21
31
  ## 0.9.7 (February 9, 2012)
22
32
 
@@ -20,6 +20,7 @@ module Vagrant
20
20
  end
21
21
 
22
22
  module General
23
+ autoload :CheckVirtualbox, 'vagrant/action/general/check_virtualbox'
23
24
  autoload :Package, 'vagrant/action/general/package'
24
25
  autoload :Validate, 'vagrant/action/general/validate'
25
26
  end
@@ -20,6 +20,7 @@ module Vagrant
20
20
  # provision - Provisions a running VM
21
21
  register(:provision) do
22
22
  Builder.new do
23
+ use General::CheckVirtualbox
23
24
  use General::Validate
24
25
  use VM::CheckAccessible
25
26
  use VM::Provision
@@ -30,6 +31,7 @@ module Vagrant
30
31
  # environment.
31
32
  register(:start) do
32
33
  Builder.new do
34
+ use General::CheckVirtualbox
33
35
  use General::Validate
34
36
  use VM::CheckAccessible
35
37
  use VM::CleanMachineFolder
@@ -53,6 +55,7 @@ module Vagrant
53
55
  # a restart if fails.
54
56
  register(:halt) do
55
57
  Builder.new do
58
+ use General::CheckVirtualbox
56
59
  use General::Validate
57
60
  use VM::CheckAccessible
58
61
  use VM::DiscardState
@@ -63,6 +66,7 @@ module Vagrant
63
66
  # suspend - Suspends the VM
64
67
  register(:suspend) do
65
68
  Builder.new do
69
+ use General::CheckVirtualbox
66
70
  use General::Validate
67
71
  use VM::CheckAccessible
68
72
  use VM::Suspend
@@ -72,6 +76,7 @@ module Vagrant
72
76
  # resume - Resume a VM
73
77
  register(:resume) do
74
78
  Builder.new do
79
+ use General::CheckVirtualbox
75
80
  use General::Validate
76
81
  use VM::CheckAccessible
77
82
  use VM::CheckPortCollisions
@@ -82,6 +87,7 @@ module Vagrant
82
87
  # reload - Halts then restarts the VM
83
88
  register(:reload) do
84
89
  Builder.new do
90
+ use General::CheckVirtualbox
85
91
  use General::Validate
86
92
  use VM::CheckAccessible
87
93
  use registry.get(:halt)
@@ -92,6 +98,7 @@ module Vagrant
92
98
  # up - Imports, prepares, then starts a fresh VM.
93
99
  register(:up) do
94
100
  Builder.new do
101
+ use General::CheckVirtualbox
95
102
  use General::Validate
96
103
  use VM::CheckAccessible
97
104
  use VM::CheckBox
@@ -106,6 +113,7 @@ module Vagrant
106
113
  # destroy - Halts, cleans up, and destroys an existing VM
107
114
  register(:destroy) do
108
115
  Builder.new do
116
+ use General::CheckVirtualbox
109
117
  use General::Validate
110
118
  use VM::CheckAccessible
111
119
  use registry.get(:halt), :force => true
@@ -120,6 +128,7 @@ module Vagrant
120
128
  # package - Export and package the VM
121
129
  register(:package) do
122
130
  Builder.new do
131
+ use General::CheckVirtualbox
123
132
  use General::Validate
124
133
  use VM::SetupPackageFiles
125
134
  use VM::CheckAccessible
@@ -135,6 +144,7 @@ module Vagrant
135
144
  # box_add - Download and add a box.
136
145
  register(:box_add) do
137
146
  Builder.new do
147
+ use General::CheckVirtualbox
138
148
  use Box::Download
139
149
  use Box::Unpackage
140
150
  use Box::Verify
@@ -0,0 +1,28 @@
1
+ module Vagrant
2
+ module Action
3
+ module General
4
+ # Checks that virtualbox is installed and ready to be used.
5
+ class CheckVirtualbox
6
+ def initialize(app, env)
7
+ @app = app
8
+ end
9
+
10
+ def call(env)
11
+ # Certain actions may not actually have a VM, and thus no
12
+ # driver, so we have to be clever about obtaining an instance
13
+ # of the driver.
14
+ driver = nil
15
+ driver = env[:vm].driver if env[:vm]
16
+ driver = Driver::VirtualBox.new(nil) if !driver
17
+
18
+ # Verify that it is ready to go! This will raise an exception
19
+ # if anything goes wrong.
20
+ driver.verify!
21
+
22
+ # Carry on.
23
+ @app.call(env)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -6,12 +6,11 @@ module Vagrant
6
6
  class Validate
7
7
  def initialize(app, env)
8
8
  @app = app
9
- @env = env
10
9
  end
11
10
 
12
11
  def call(env)
13
- @env[:vm].config.validate!(@env[:vm].env) if !@env.has_key?("validate") || @env["validate"]
14
- @app.call(@env)
12
+ env[:vm].config.validate!(env[:vm].env) if !env.has_key?("validate") || env["validate"]
13
+ @app.call(env)
15
14
  end
16
15
  end
17
16
  end
@@ -37,12 +37,9 @@ module Vagrant
37
37
  adapters << adapter
38
38
 
39
39
  # Get the network configuration
40
- if config[:auto_config]
41
- network = send("#{type}_network_config", config)
42
- networks << network
43
- else
44
- @logger.info("Auto config disabled, not configuring: #{type}")
45
- end
40
+ network = send("#{type}_network_config", config)
41
+ network[:_auto_config] = true if config[:auto_config]
42
+ networks << network
46
43
  end
47
44
 
48
45
  if !adapters.empty?
@@ -68,9 +65,11 @@ module Vagrant
68
65
  # Determine the interface numbers for the guest.
69
66
  assign_interface_numbers(networks, adapters)
70
67
 
71
- # Configure all the network interfaces on the guest.
68
+ # Configure all the network interfaces on the guest. We only
69
+ # want to configure the networks that have `auto_config` setup.
70
+ networks_to_configure = networks.select { |n| n[:_auto_config] }
72
71
  env[:ui].info I18n.t("vagrant.actions.vm.network.configuring")
73
- env[:vm].guest.configure_networks(networks)
72
+ env[:vm].guest.configure_networks(networks_to_configure)
74
73
  end
75
74
  end
76
75
 
@@ -253,7 +252,8 @@ module Vagrant
253
252
  :adapter => config[:adapter],
254
253
  :type => :hostonly,
255
254
  :hostonly => interface[:name],
256
- :mac_address => config[:mac]
255
+ :mac_address => config[:mac],
256
+ :nic_type => config[:nic_type]
257
257
  }
258
258
  end
259
259
 
@@ -309,6 +309,7 @@ module Vagrant
309
309
 
310
310
  def bridged_config(args)
311
311
  options = args[0] || {}
312
+ options = {} if !options.is_a?(Hash)
312
313
 
313
314
  return {
314
315
  :adapter => nil,
@@ -1,3 +1,4 @@
1
+ require 'digest/md5'
1
2
  require 'fileutils'
2
3
  require 'pathname'
3
4
 
@@ -93,6 +94,12 @@ module Vagrant
93
94
  opts[:map_gid] = prepare_permission(:gid, opts)
94
95
  opts[:nfs_version] ||= 3
95
96
 
97
+ # The poor man's UUID. An MD5 hash here is sufficient since
98
+ # we need a 32 character "uuid" to represent the filesystem
99
+ # of an export. Hashing the host path is safe because two of
100
+ # the same host path will hash to the same fsid.
101
+ opts[:uuid] = Digest::MD5.hexdigest(opts[:hostpath])
102
+
96
103
  acc[key] = opts
97
104
  acc
98
105
  end
@@ -60,10 +60,13 @@ module Vagrant
60
60
  # @param [String] name The name of the VM. Nil if every VM.
61
61
  # @param [Boolean] single_target If true, then an exception will be
62
62
  # raised if more than one target is found.
63
- def with_target_vms(name=nil, single_target=false)
63
+ def with_target_vms(name=nil, options=nil)
64
64
  # Using VMs requires a Vagrant environment to be properly setup
65
65
  raise Errors::NoEnvironmentError if !@env.root_path
66
66
 
67
+ # Setup the options hash
68
+ options ||= {}
69
+
67
70
  # First determine the proper array of VMs.
68
71
  vms = []
69
72
  if name
@@ -89,7 +92,10 @@ module Vagrant
89
92
  end
90
93
 
91
94
  # Make sure we're only working with one VM if single target
92
- raise Errors::MultiVMTargetRequired if single_target && vms.length != 1
95
+ raise Errors::MultiVMTargetRequired if options[:single_target] && vms.length != 1
96
+
97
+ # If we asked for reversed ordering, then reverse it
98
+ vms.reverse! if options[:reverse]
93
99
 
94
100
  # Go through each VM and yield it!
95
101
  vms.each do |old_vm|
@@ -20,7 +20,7 @@ module Vagrant
20
20
  return if !argv
21
21
 
22
22
  @logger.debug("'Destroy' each target VM...")
23
- with_target_vms(argv[0]) do |vm|
23
+ with_target_vms(argv[0], :reverse => true) do |vm|
24
24
  if vm.created?
25
25
  # Boolean whether we should actually go through with the destroy
26
26
  # or not. This is true only if the "--force" flag is set or if the
@@ -51,7 +51,7 @@ module Vagrant
51
51
  end
52
52
 
53
53
  def package_target(name, options)
54
- with_target_vms(name, true) do |vm|
54
+ with_target_vms(name, :single_target => true) do |vm|
55
55
  raise Errors::VMNotCreatedError if !vm.created?
56
56
  @logger.debug("Packaging VM: #{vm.name}")
57
57
  package_vm(vm, options)
@@ -36,7 +36,7 @@ module Vagrant
36
36
  argv = [] if argv == ssh_args
37
37
 
38
38
  # Execute the actual SSH
39
- with_target_vms(argv[0], true) do |vm|
39
+ with_target_vms(argv[0], :single_target => true) do |vm|
40
40
  # Basic checks that are required for proper SSH
41
41
  raise Errors::VMNotCreatedError if !vm.created?
42
42
  raise Errors::VMInaccessible if !vm.state == :inaccessible
@@ -19,7 +19,7 @@ module Vagrant
19
19
  argv = parse_options(opts)
20
20
  return if !argv
21
21
 
22
- with_target_vms(argv[0], true) do |vm|
22
+ with_target_vms(argv[0], :single_target => true) do |vm|
23
23
  raise Errors::VMNotCreatedError if !vm.created?
24
24
  raise Errors::VMInaccessible if !vm.state == :inaccessible
25
25
 
@@ -82,6 +82,8 @@ module Vagrant
82
82
  current = Top.new
83
83
  proc.call(current)
84
84
  @config_cache[proc] = current
85
+ else
86
+ @logger.debug("Loading from: #{key} (cache)")
85
87
  end
86
88
 
87
89
  # Merge in the results of this proc's configuration
@@ -99,6 +99,7 @@ module Vagrant
99
99
  :ssh_port,
100
100
  :start,
101
101
  :suspend,
102
+ :verify!,
102
103
  :verify_image,
103
104
  :vm_exists?
104
105
 
@@ -440,6 +440,12 @@ module Vagrant
440
440
  execute("controlvm", @uuid, "savestate")
441
441
  end
442
442
 
443
+ def verify!
444
+ # This command sometimes fails if kernel drivers aren't properly loaded
445
+ # so we just run the command and verify that it succeeded.
446
+ execute("list", "hostonlyifs")
447
+ end
448
+
443
449
  def verify_image(path)
444
450
  r = raw("import", path.to_s, "--dry-run")
445
451
  return r.exit_code == 0
@@ -440,6 +440,12 @@ module Vagrant
440
440
  execute("controlvm", @uuid, "savestate")
441
441
  end
442
442
 
443
+ def verify!
444
+ # This command sometimes fails if kernel drivers aren't properly loaded
445
+ # so we just run the command and verify that it succeeded.
446
+ execute("list", "hostonlyifs")
447
+ end
448
+
443
449
  def verify_image(path)
444
450
  r = raw("import", path.to_s, "--dry-run")
445
451
  return r.exit_code == 0
@@ -234,6 +234,12 @@ module Vagrant
234
234
  def suspend
235
235
  end
236
236
 
237
+ # Verifies that the driver is ready to accept work.
238
+ #
239
+ # This should raise a VagrantError if things are not ready.
240
+ def verify!
241
+ end
242
+
237
243
  # Verifies that an image can be imported properly.
238
244
  #
239
245
  # @param [String] path Path to an OVF file.
@@ -57,7 +57,9 @@ module Vagrant
57
57
  temp.write(config_file)
58
58
  temp.close
59
59
 
60
- env[:vm].channel.upload(temp.path, File.join(config.provisioning_path, filename))
60
+ remote_file = File.join(config.provisioning_path, filename)
61
+ env[:vm].channel.sudo("rm #{remote_file}", :error_check => false)
62
+ env[:vm].channel.upload(temp.path, remote_file)
61
63
  end
62
64
 
63
65
  def setup_json
@@ -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.9.99.1"
5
+ VERSION = "0.9.99.2"
6
6
  end
data/lib/vagrant/vm.rb CHANGED
@@ -131,7 +131,7 @@ module Vagrant
131
131
  # Clear the UUID since this VM doesn't exist. Note that this calls
132
132
  # back into `reload!` but shouldn't ever result in infinite
133
133
  # recursion since `@uuid` will be nil.
134
- self.uuid = nil
134
+ @uuid = nil
135
135
  end
136
136
  end
137
137
 
@@ -255,6 +255,11 @@ en:
255
255
  stopped without properly closing the session. Run `vagrant up`
256
256
  to resume this virtual machine. If any problems persist, you may
257
257
  have to destroy and restart the virtual machine.
258
+ gurumeditation: |-
259
+ The VM is in the "guru meditation" state. This is a rare case which means
260
+ that an internal error in VitualBox caused the VM to fail. This is always
261
+ the sign of a bug in VirtualBox. You can try to bring your VM back online
262
+ with a `vagrant up`.
258
263
  inaccessible: |-
259
264
  The VM is inaccessible! This is a rare case which means that VirtualBox
260
265
  can't find your VM configuration. This usually happens when upgrading
@@ -1,5 +1,5 @@
1
1
  # VAGRANT-BEGIN: <%= uuid %>
2
2
  <% folders.each do |name, opts| %>
3
- "<%= opts[:hostpath] %>" <%= ip %>(rw,no_subtree_check,all_squash<% if opts[:map_uid] %>,anonuid=<%= opts[:map_uid] %><% end %><% if opts[:map_gid] %>,anongid=<%= opts[:map_gid] %><% end %>)
3
+ "<%= opts[:hostpath] %>" <%= ip %>(rw,no_subtree_check,all_squash<% if opts[:map_uid] %>,anonuid=<%= opts[:map_uid] %><% end %><% if opts[:map_gid] %>,anongid=<%= opts[:map_gid] %><% end %>,fsid=<%= opts[:uuid] %>)
4
4
  <% end %>
5
5
  # VAGRANT-END: <%= uuid %>
data/vagrant.gemspec CHANGED
@@ -17,11 +17,11 @@ Gem::Specification.new do |s|
17
17
  s.add_dependency "archive-tar-minitar", "= 0.5.2"
18
18
  s.add_dependency "childprocess", "~> 0.3.1"
19
19
  s.add_dependency "erubis", "~> 2.7.0"
20
+ s.add_dependency "i18n", "~> 0.6.0"
20
21
  s.add_dependency "json", "~> 1.5.1"
21
22
  s.add_dependency "log4r", "~> 1.1.9"
22
23
  s.add_dependency "net-ssh", "~> 2.2.2"
23
24
  s.add_dependency "net-scp", "~> 1.0.4"
24
- s.add_dependency "i18n", "~> 0.6.0"
25
25
 
26
26
  s.add_development_dependency "rake"
27
27
  s.add_development_dependency "contest", ">= 0.1.2"
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.9.99.1
4
+ version: 0.9.99.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mitchell Hashimoto
@@ -53,6 +53,20 @@ dependencies:
53
53
  - - ~>
54
54
  - !ruby/object:Gem::Version
55
55
  version: 2.7.0
56
+ - !ruby/object:Gem::Dependency
57
+ name: i18n
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: 0.6.0
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 0.6.0
56
70
  - !ruby/object:Gem::Dependency
57
71
  name: json
58
72
  requirement: !ruby/object:Gem::Requirement
@@ -109,20 +123,6 @@ dependencies:
109
123
  - - ~>
110
124
  - !ruby/object:Gem::Version
111
125
  version: 1.0.4
112
- - !ruby/object:Gem::Dependency
113
- name: i18n
114
- requirement: !ruby/object:Gem::Requirement
115
- requirements:
116
- - - ~>
117
- - !ruby/object:Gem::Version
118
- version: 0.6.0
119
- type: :runtime
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - ~>
124
- - !ruby/object:Gem::Version
125
- version: 0.6.0
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: rake
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -257,6 +257,7 @@ files:
257
257
  - lib/vagrant/action/builtin.rb
258
258
  - lib/vagrant/action/env/set.rb
259
259
  - lib/vagrant/action/environment.rb
260
+ - lib/vagrant/action/general/check_virtualbox.rb
260
261
  - lib/vagrant/action/general/package.rb
261
262
  - lib/vagrant/action/general/validate.rb
262
263
  - lib/vagrant/action/runner.rb