vagrantup 0.7.1 → 0.7.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: bccdcf3264499ef90bbc9b789fe40694278b433a
4
- data.tar.gz: 9e1cf811d44570ed1fa11a873d5d935901a90952
3
+ metadata.gz: d141d5cc631baefb68f687fa58d80ea23ce02eb8
4
+ data.tar.gz: 6728e47dee0afb290b4af6454573177f5b730752
5
5
  SHA512:
6
- metadata.gz: bbc101609370a5d45a299fdbf5c3c1b65d8c0a8aa53d9c0b263fe42b61ff323b993bc8b8150279eaed193b2a1924f2d6a571b56397c8f9666581e4c3bf356132
7
- data.tar.gz: eedfd8548df8d16eea8cbf5bfb0ad7606b799b7fb760c6955f82af411649197c57f762ab6395191f5d50ebf8e3f98eb4b10cd62a3ba79a6541ce3b0e99efbc64
6
+ metadata.gz: 1641fb390cea4223932a2d19c1f65877b63803569cc17e9bbf904d9063d855e0907ee801ebb2b72904f433ab5331e54aa592cfec70a212f5f3cfbe3db9154c1e
7
+ data.tar.gz: 407d67d12bf887a4c35fc57fda51303ab43b0459a8bb87f5068df7cbf94974b37d141da355f359659f93d71c4d66da74ac1bcc19a9aa4f78598fe8fa3a4e4f2d
data/CHANGELOG.md CHANGED
@@ -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
 
data/lib/vagrant/ssh.rb CHANGED
@@ -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
data/vagrant.gemspec CHANGED
@@ -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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrantup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mitchell Hashimoto
@@ -45,14 +45,14 @@ dependencies:
45
45
  requirements:
46
46
  - - ~>
47
47
  - !ruby/object:Gem::Version
48
- version: 1.4.6
48
+ version: 1.5.1
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ~>
54
54
  - !ruby/object:Gem::Version
55
- version: 1.4.6
55
+ version: 1.5.1
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: mario
58
58
  requirement: !ruby/object:Gem::Requirement