vagrant 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,15 @@
1
+ ## 0.7.2 (February 8, 2011)
2
+
3
+ - Update JSON dependency to 1.5.1, which works with Ruby 1.9 on
4
+ Windows.
5
+ - Fix sudo issues on sudo < 1.7.0 (again).
6
+ - Fix race condition in SSH, which specifically manifested itself in
7
+ the chef server provisioner. [GH-295]
8
+ - Change sudo shell to use `bash` (configurable). [GH-301]
9
+ - Can now set mac address of host only network. [GH-294]
10
+ - NFS shared folders with spaces now work properly. [GH-293]
11
+ - Failed SSH commands now show output in error message. [GH-285]
12
+
1
13
  ## 0.7.1 (January 28, 2011)
2
14
 
3
15
  - Change error output with references to VirtualBox 3.2 to 4.0.
data/Gemfile CHANGED
@@ -14,6 +14,8 @@ group :test do
14
14
  gem "mocha"
15
15
 
16
16
  # For documentation
17
- gem "yard", "~> 0.6.1"
18
- gem "bluecloth"
17
+ platforms :ruby do
18
+ gem "yard", "~> 0.6.1"
19
+ gem "bluecloth"
20
+ end
19
21
  end
@@ -8,7 +8,7 @@ module Vagrant
8
8
  @app = app
9
9
  @env = env
10
10
 
11
- if enable_network? && Util::Platform.windows?
11
+ if enable_network? && Util::Platform.windows? && Util::Platform.bit64?
12
12
  raise Errors::NetworkNotImplemented
13
13
  end
14
14
 
@@ -65,6 +65,7 @@ module Vagrant
65
65
  adapter.enabled = true
66
66
  adapter.attachment_type = :host_only
67
67
  adapter.host_interface = network_name(network_options)
68
+ adapter.mac_address = network_options[:mac].gsub(':', '') if network_options[:mac]
68
69
  adapter.save
69
70
  end
70
71
  end
@@ -11,6 +11,11 @@ module Vagrant
11
11
  attr_writer :private_key_path
12
12
  attr_accessor :forward_agent
13
13
  attr_accessor :forward_x11
14
+ attr_accessor :sudo_shell
15
+
16
+ def initialize
17
+ @sudo_shell = "bash"
18
+ end
14
19
 
15
20
  def private_key_path
16
21
  File.expand_path(@private_key_path, env.root_path)
@@ -55,6 +55,7 @@ module Vagrant
55
55
  :ip => ip,
56
56
  :netmask => "255.255.255.0",
57
57
  :adapter => 1,
58
+ :mac => nil,
58
59
  :name => nil
59
60
  }.merge(options || {})
60
61
 
@@ -19,13 +19,13 @@ module Vagrant
19
19
  @file_path = file_path
20
20
  return if !file_path
21
21
 
22
- File.open(file_path, "r") do |f|
23
- merge!(JSON.parse(f.read))
22
+ raise Errors::DotfileIsDirectory if File.directory?(file_path)
23
+
24
+ if File.exist?(file_path)
25
+ File.open(file_path, "r") do |f|
26
+ merge!(JSON.parse(f.read))
27
+ end
24
28
  end
25
- rescue Errno::ENOENT
26
- clear
27
- rescue Errno::EISDIR
28
- raise Errors::DotfileIsDirectory
29
29
  end
30
30
 
31
31
  # Commits any changes to the data to disk. Even if the data
@@ -25,6 +25,7 @@ module Vagrant
25
25
  output.split("\n").each do |line|
26
26
  # This should only ask for administrative permission once, even
27
27
  # though its executed in multiple subshells.
28
+ line = line.gsub('"', '\"')
28
29
  system(%Q[sudo su root -c "echo '#{line}' >> /etc/exports"])
29
30
  end
30
31
 
@@ -79,7 +79,7 @@ module Vagrant
79
79
  :user_known_hosts_file => [],
80
80
  :paranoid => false,
81
81
  :config => false)) do |ssh|
82
- yield SSH::Session.new(ssh)
82
+ yield SSH::Session.new(ssh, env)
83
83
  end
84
84
  end
85
85
  rescue Errno::ECONNREFUSED
@@ -7,9 +7,11 @@ module Vagrant
7
7
  include Util::Retryable
8
8
 
9
9
  attr_reader :session
10
+ attr_reader :env
10
11
 
11
- def initialize(session)
12
+ def initialize(session, env)
12
13
  @session = session
14
+ @env = env
13
15
  end
14
16
 
15
17
  # Executes a given command and simply returns true/false if the
@@ -31,8 +33,8 @@ module Vagrant
31
33
  # this command is tailor-made to be compliant with older versions
32
34
  # of `sudo`.
33
35
  def sudo!(commands, options=nil, &block)
34
- session.open_channel do |ch|
35
- ch.exec("sudo -i sh") do |ch2, success|
36
+ channel = session.open_channel do |ch|
37
+ ch.exec("sudo #{env.config.ssh.sudo_shell} -l") do |ch2, success|
36
38
  # Output each command as if they were entered on the command line
37
39
  [commands].flatten.each do |command|
38
40
  ch2.send_data "#{command}\n"
@@ -45,9 +47,10 @@ module Vagrant
45
47
  # stdout/stderr and error checking goodies
46
48
  setup_channel_callbacks(ch2, commands, options, block)
47
49
  end
48
-
49
- ch.wait
50
50
  end
51
+
52
+ channel.wait
53
+ channel[:result]
51
54
  end
52
55
 
53
56
  # Executes a given command on the SSH session and blocks until
@@ -74,7 +77,7 @@ module Vagrant
74
77
  options = { :error_check => true }.merge(options || {})
75
78
 
76
79
  block ||= Proc.new do |ch, type, data|
77
- check_exit_status(data, command, options) if type == :exit_status && options[:error_check]
80
+ check_exit_status(data, command, options, ch[:result]) if type == :exit_status && options[:error_check]
78
81
 
79
82
  ch[:result] ||= ""
80
83
  ch[:result] << data if [:stdout, :stderr].include?(type)
@@ -98,12 +101,14 @@ module Vagrant
98
101
 
99
102
  # Checks for an erroroneous exit status and raises an exception
100
103
  # if so.
101
- def check_exit_status(exit_status, commands, options=nil)
104
+ def check_exit_status(exit_status, commands, options=nil, output=nil)
102
105
  if exit_status != 0
106
+ output ||= '[no output]'
103
107
  options = {
104
108
  :_error_class => Errors::VagrantError,
105
109
  :_key => :ssh_bad_exit_status,
106
- :command => [commands].flatten.join("\n")
110
+ :command => [commands].flatten.join("\n"),
111
+ :output => output
107
112
  }.merge(options || {})
108
113
 
109
114
  raise options[:_error_class], options
@@ -26,6 +26,7 @@ module Vagrant
26
26
  vm.ssh.execute do |ssh|
27
27
  if !ssh.test?("sudo hostname | grep '#{name}'")
28
28
  ssh.exec!("sudo sed -i 's/.*$/#{name}/' /etc/hostname")
29
+ ssh.exec!("sudo sed -i 's@^\\(127[.]0[.]1[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts")
29
30
  ssh.exec!("sudo service hostname start")
30
31
  end
31
32
  end
@@ -45,7 +45,7 @@ module Vagrant
45
45
  folders.each do |name, opts|
46
46
  vm.ssh.execute do |ssh|
47
47
  ssh.exec!("sudo mkdir -p #{opts[:guestpath]}")
48
- ssh.exec!("sudo mount #{ip}:#{opts[:hostpath]} #{opts[:guestpath]}", :error_class => LinuxError, :_key => :mount_nfs_fail)
48
+ ssh.exec!("sudo mount #{ip}:'#{opts[:hostpath]}' #{opts[:guestpath]}", :_error_class => LinuxError, :_key => :mount_nfs_fail)
49
49
  end
50
50
  end
51
51
  end
@@ -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.7.1"
5
+ VERSION = "0.7.2"
6
6
  end
@@ -70,6 +70,10 @@ en:
70
70
  Vagrant assumes that this means the command failed!
71
71
 
72
72
  %{command}
73
+
74
+ The output of the command prior to failing is outputted below:
75
+
76
+ %{output}
73
77
  ssh_connection_refused: |-
74
78
  SSH connection was refused! This usually happens if the VM failed to
75
79
  boot properly. Some steps to try to fix this: First, try reloading your
@@ -1,5 +1,5 @@
1
1
  # VAGRANT-BEGIN: <%= uuid %>
2
2
  <% folders.each do |name, opts| %>
3
- <%= opts[:hostpath] %> <%= ip %><% if opts[:map_uid] -%> -mapall=<%= [opts[:map_uid],opts[:map_gid]].compact.join(":") %><% end -%>
3
+ "<%= opts[:hostpath] %>" <%= ip %><% if opts[:map_uid] -%> -mapall=<%= [opts[:map_uid],opts[:map_gid]].compact.join(":") %><% end -%>
4
4
  <% end %>
5
5
  # VAGRANT-END: <%= uuid %>
@@ -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 %>)
4
4
  <% end %>
5
5
  # VAGRANT-END: <%= uuid %>
@@ -16,8 +16,9 @@ class NetworkVMActionTest < Test::Unit::TestCase
16
16
  end
17
17
 
18
18
  context "initializing" do
19
- should "raise an error if on windows and networking is enabled" do
19
+ should "raise an error if on windows x64 and networking is enabled" do
20
20
  Vagrant::Util::Platform.stubs(:windows?).returns(true)
21
+ Vagrant::Util::Platform.stubs(:bit64?).returns(true)
21
22
  @env.env.config.vm.network("foo")
22
23
 
23
24
  assert_raises(Vagrant::Errors::NetworkNotImplemented) {
@@ -115,24 +116,44 @@ class NetworkVMActionTest < Test::Unit::TestCase
115
116
 
116
117
  @network_adapters = []
117
118
  @internal_vm.stubs(:network_adapters).returns(@network_adapters)
119
+ end
118
120
 
119
- @options = {
121
+ def expect_adapter_setup(options=nil)
122
+ options = {
120
123
  :ip => "foo",
121
124
  :adapter => 7
122
- }
125
+ }.merge(options || {})
123
126
 
124
- @env.env.config.vm.network(@options[:ip], @options)
125
- end
127
+ @env["config"].vm.network(options[:ip], options)
126
128
 
127
- should "setup the specified network adapter" do
128
- adapter = mock("adapter")
129
- @network_adapters[@options[:adapter]] = adapter
129
+ @env["vm"].vm.network_adapters.clear
130
+ @env["vm"].vm.network_adapters[options[:adapter]] = adapter = mock("adapter")
130
131
 
131
- adapter.expects(:enabled=).with(true).once
132
+ adapter.expects(:enabled=).with(true)
132
133
  adapter.expects(:attachment_type=).with(:host_only).once
133
134
  adapter.expects(:host_interface=).with(@network_name).once
135
+
136
+ if options[:mac]
137
+ adapter.expects(:mac_address=).with(options[:mac].gsub(':', '')).once
138
+ else
139
+ adapter.expects(:mac_address=).never
140
+ end
141
+
134
142
  adapter.expects(:save).once
143
+ end
144
+
145
+ should "setup the specified network adapter" do
146
+ expect_adapter_setup
147
+ @instance.assign_network
148
+ end
149
+
150
+ should "setup the specified network adapter's mac address if specified" do
151
+ expect_adapter_setup(:mac => "foo")
152
+ @instance.assign_network
153
+ end
135
154
 
155
+ should "properly remove : from mac address" do
156
+ expect_adapter_setup(:mac => "foo:bar")
136
157
  @instance.assign_network
137
158
  end
138
159
  end
@@ -3,9 +3,10 @@ require "test_helper"
3
3
  class SshSessionTest < Test::Unit::TestCase
4
4
  setup do
5
5
  @session = mock("session")
6
+ @env = vagrant_env
6
7
 
7
8
  @klass = Vagrant::SSH::Session
8
- @instance = @klass.new(@session)
9
+ @instance = @klass.new(@session, @env)
9
10
  end
10
11
 
11
12
  context "exec!" do
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
 
17
17
  s.add_dependency "archive-tar-minitar", "= 0.5.2"
18
18
  s.add_dependency "erubis", "~> 2.6.6"
19
- s.add_dependency "json", "~> 1.4.6"
19
+ s.add_dependency "json", "~> 1.5.1"
20
20
  s.add_dependency "mario", "~> 0.0.6"
21
21
  s.add_dependency "net-ssh", "~> 2.1.0"
22
22
  s.add_dependency "net-scp", "~> 1.0.4"
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 7
8
- - 1
9
- version: 0.7.1
4
+ prerelease:
5
+ version: 0.7.2
10
6
  platform: ruby
11
7
  authors:
12
8
  - Mitchell Hashimoto
@@ -15,7 +11,7 @@ autorequire:
15
11
  bindir: bin
16
12
  cert_chain: []
17
13
 
18
- date: 2011-01-28 00:00:00 -08:00
14
+ date: 2011-02-08 00:00:00 -08:00
19
15
  default_executable:
20
16
  dependencies:
21
17
  - !ruby/object:Gem::Dependency
@@ -25,10 +21,6 @@ dependencies:
25
21
  requirements:
26
22
  - - "="
27
23
  - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- - 5
31
- - 2
32
24
  version: 0.5.2
33
25
  type: :runtime
34
26
  prerelease: false
@@ -40,10 +32,6 @@ dependencies:
40
32
  requirements:
41
33
  - - ~>
42
34
  - !ruby/object:Gem::Version
43
- segments:
44
- - 2
45
- - 6
46
- - 6
47
35
  version: 2.6.6
48
36
  type: :runtime
49
37
  prerelease: false
@@ -55,11 +43,7 @@ dependencies:
55
43
  requirements:
56
44
  - - ~>
57
45
  - !ruby/object:Gem::Version
58
- segments:
59
- - 1
60
- - 4
61
- - 6
62
- version: 1.4.6
46
+ version: 1.5.1
63
47
  type: :runtime
64
48
  prerelease: false
65
49
  version_requirements: *id003
@@ -70,10 +54,6 @@ dependencies:
70
54
  requirements:
71
55
  - - ~>
72
56
  - !ruby/object:Gem::Version
73
- segments:
74
- - 0
75
- - 0
76
- - 6
77
57
  version: 0.0.6
78
58
  type: :runtime
79
59
  prerelease: false
@@ -85,10 +65,6 @@ dependencies:
85
65
  requirements:
86
66
  - - ~>
87
67
  - !ruby/object:Gem::Version
88
- segments:
89
- - 2
90
- - 1
91
- - 0
92
68
  version: 2.1.0
93
69
  type: :runtime
94
70
  prerelease: false
@@ -100,10 +76,6 @@ dependencies:
100
76
  requirements:
101
77
  - - ~>
102
78
  - !ruby/object:Gem::Version
103
- segments:
104
- - 1
105
- - 0
106
- - 4
107
79
  version: 1.0.4
108
80
  type: :runtime
109
81
  prerelease: false
@@ -115,10 +87,6 @@ dependencies:
115
87
  requirements:
116
88
  - - ~>
117
89
  - !ruby/object:Gem::Version
118
- segments:
119
- - 0
120
- - 5
121
- - 0
122
90
  version: 0.5.0
123
91
  type: :runtime
124
92
  prerelease: false
@@ -130,10 +98,6 @@ dependencies:
130
98
  requirements:
131
99
  - - ~>
132
100
  - !ruby/object:Gem::Version
133
- segments:
134
- - 0
135
- - 14
136
- - 6
137
101
  version: 0.14.6
138
102
  type: :runtime
139
103
  prerelease: false
@@ -145,10 +109,6 @@ dependencies:
145
109
  requirements:
146
110
  - - ~>
147
111
  - !ruby/object:Gem::Version
148
- segments:
149
- - 0
150
- - 8
151
- - 3
152
112
  version: 0.8.3
153
113
  type: :runtime
154
114
  prerelease: false
@@ -160,8 +120,6 @@ dependencies:
160
120
  requirements:
161
121
  - - ">="
162
122
  - !ruby/object:Gem::Version
163
- segments:
164
- - 0
165
123
  version: "0"
166
124
  type: :development
167
125
  prerelease: false
@@ -173,10 +131,6 @@ dependencies:
173
131
  requirements:
174
132
  - - ">="
175
133
  - !ruby/object:Gem::Version
176
- segments:
177
- - 0
178
- - 1
179
- - 2
180
134
  version: 0.1.2
181
135
  type: :development
182
136
  prerelease: false
@@ -188,8 +142,6 @@ dependencies:
188
142
  requirements:
189
143
  - - ">="
190
144
  - !ruby/object:Gem::Version
191
- segments:
192
- - 0
193
145
  version: "0"
194
146
  type: :development
195
147
  prerelease: false
@@ -201,8 +153,6 @@ dependencies:
201
153
  requirements:
202
154
  - - ">="
203
155
  - !ruby/object:Gem::Version
204
- segments:
205
- - 0
206
156
  version: "0"
207
157
  type: :development
208
158
  prerelease: false
@@ -471,7 +421,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
471
421
  requirements:
472
422
  - - ">="
473
423
  - !ruby/object:Gem::Version
474
- hash: 1780875607345345301
424
+ hash: -3903323204405395882
475
425
  segments:
476
426
  - 0
477
427
  version: "0"
@@ -480,15 +430,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
480
430
  requirements:
481
431
  - - ">="
482
432
  - !ruby/object:Gem::Version
483
- segments:
484
- - 1
485
- - 3
486
- - 6
487
433
  version: 1.3.6
488
434
  requirements: []
489
435
 
490
436
  rubyforge_project: vagrant
491
- rubygems_version: 1.3.7
437
+ rubygems_version: 1.5.0
492
438
  signing_key:
493
439
  specification_version: 3
494
440
  summary: Build and distribute virtualized development environments.