vagrantup 0.9.2 → 0.9.3

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: ff1d2d39890e5454d9dbcb5f74335c1ad4eed4c4
4
- data.tar.gz: f4459db1777471988574c8ddb839499cc97b1811
3
+ metadata.gz: bce7b6eeae444bf20234892e06d974d0612aa928
4
+ data.tar.gz: bfa089718d5c2387d5580c4207c20f79b1071ef2
5
5
  SHA512:
6
- metadata.gz: 2020561036cab64196337d908aa18a3fd5744d653cdf3d8aa6e2755d01d727d8908d88a751e1591bb79c3d9f9ee4a5f194b8b5030573c29ab5bc59174eb3d1b1
7
- data.tar.gz: 624ff2ca03284eb125dcfb2352f2ff31553255f9e023e4f635bf11bdc1dbce1e93be5a42db5fe92e2009873a12dcfad95da46f8773f68d22b8de4a6d11c16e64
6
+ metadata.gz: 3645050437b980983b3613cb280d4eb422cf84072292a9ef678be4ed7d565531fe21fc084ac07ddd6271eccf9edd84d9614734341b47771ad60e3cf18b64b14a
7
+ data.tar.gz: 64c5d97c804d76b14615aaf5ae4d8967cb6827fd7cade81305741b667c134a3f1454fc2bb3a63405c1e7a23d390b51c8995d344f5f113130aac96890705bd05c
@@ -1,3 +1,11 @@
1
+ ## 0.9.3 (January 24, 2012)
2
+
3
+ - Proper error handling for not enough arguments to `box` commands.
4
+ - Fix issue causing crashes with bridged networking. [GH-673]
5
+ - Ignore host only network interfaces that are "down." [GH-675]
6
+ - Use "printf" instead of "echo" to determine shell expanded files paths
7
+ which is more generally POSIX compliant. [GH-676]
8
+
1
9
  ## 0.9.2 (January 20, 2012)
2
10
 
3
11
  - Support shell expansions in shared folder guest paths again. [GH-656]
@@ -298,7 +298,7 @@ module Vagrant
298
298
 
299
299
  @env[:vm].driver.read_bridged_interfaces.each do |interface|
300
300
  that_netaddr = network_address(interface[:ip], interface[:netmask])
301
- raise Errors::NetworkCollision if this_netaddr == that_netaddr
301
+ raise Errors::NetworkCollision if this_netaddr == that_netaddr && interface[:status] != "Down"
302
302
  end
303
303
  end
304
304
 
@@ -341,7 +341,7 @@ module Vagrant
341
341
  chosen_bridge = bridgedifs[choice - 1][:name]
342
342
  end
343
343
 
344
- @logger.info("Bridging adapter #{config[:adapter]} to #{bridge}")
344
+ @logger.info("Bridging adapter #{config[:adapter]} to #{chosen_bridge}")
345
345
 
346
346
  # Given the choice we can now define the adapter we're using
347
347
  return {
@@ -18,6 +18,7 @@ module Vagrant
18
18
  # Parse the options
19
19
  argv = parse_options(opts)
20
20
  return if !argv
21
+ raise Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length < 2
21
22
 
22
23
  # If we're force adding, then be sure to destroy any existing box if it
23
24
  # exists.
@@ -13,6 +13,7 @@ module Vagrant
13
13
  # Parse the options
14
14
  argv = parse_options(opts)
15
15
  return if !argv
16
+ raise Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length < 1
16
17
 
17
18
  b = @env.boxes.find(argv[0])
18
19
  raise Errors::BoxNotFound, :name => argv[0] if !b
@@ -13,6 +13,7 @@ module Vagrant
13
13
  # Parse the options
14
14
  argv = parse_options(opts)
15
15
  return if !argv
16
+ raise Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length < 1
16
17
 
17
18
  b = @env.boxes.find(argv[0])
18
19
  raise Errors::BoxNotFound, :name => argv[0] if !b
@@ -4,6 +4,7 @@ require 'log4r'
4
4
  require 'net/ssh'
5
5
  require 'net/scp'
6
6
 
7
+ require 'vagrant/util/ansi_escape_code_remover'
7
8
  require 'vagrant/util/file_mode'
8
9
  require 'vagrant/util/platform'
9
10
  require 'vagrant/util/retryable'
@@ -12,6 +13,7 @@ module Vagrant
12
13
  module Communication
13
14
  # Provides communication with the VM via SSH.
14
15
  class SSH < Base
16
+ include Util::ANSIEscapeCodeRemover
15
17
  include Util::Retryable
16
18
 
17
19
  def initialize(vm)
@@ -169,7 +171,7 @@ module Vagrant
169
171
  ch2.on_data do |ch3, data|
170
172
  if block_given?
171
173
  # Filter out the clear screen command
172
- data.gsub!("\e[H", "")
174
+ data = remove_ansi_escape_codes(data)
173
175
  @logger.debug("stdout: #{data}")
174
176
  yield :stdout, data
175
177
  end
@@ -178,7 +180,7 @@ module Vagrant
178
180
  ch2.on_extended_data do |ch3, type, data|
179
181
  if block_given?
180
182
  # Filter out the clear screen command
181
- data.gsub!("\e[H", "")
183
+ data = remove_ansi_escape_codes(data)
182
184
  @logger.debug("stderr: #{data}")
183
185
  yield :stderr, data
184
186
  end
@@ -273,6 +273,8 @@ module Vagrant
273
273
  info[:ip] = $1.to_s
274
274
  elsif line =~ /^NetworkMask:\s+(.+?)$/
275
275
  info[:netmask] = $1.to_s
276
+ elsif line =~ /^Status:\s+(.+?)$/
277
+ info[:status] = $1.to_s
276
278
  end
277
279
  end
278
280
 
@@ -273,6 +273,8 @@ module Vagrant
273
273
  info[:ip] = $1.to_s
274
274
  elsif line =~ /^NetworkMask:\s+(.+?)$/
275
275
  info[:netmask] = $1.to_s
276
+ elsif line =~ /^Status:\s+(.+?)$/
277
+ info[:status] = $1.to_s
276
278
  end
277
279
  end
278
280
 
@@ -128,6 +128,11 @@ module Vagrant
128
128
  error_key(:failed, "vagrant.actions.box.verify")
129
129
  end
130
130
 
131
+ class CLIInvalidUsage < VagrantError
132
+ status_code(69)
133
+ error_key(:cli_invalid_usage)
134
+ end
135
+
131
136
  class CLIInvalidOptions < VagrantError
132
137
  status_code(1)
133
138
  error_key(:cli_invalid_options)
@@ -47,7 +47,7 @@ module Vagrant
47
47
  # else, things like '~' don't expand properly in shared folders. We have
48
48
  # to `echo` here to get that path.
49
49
  real_guestpath = nil
50
- @vm.channel.execute("echo #{guestpath}") do |type, data|
50
+ @vm.channel.execute("printf #{guestpath}") do |type, data|
51
51
  if type == :stdout
52
52
  real_guestpath ||= ""
53
53
  real_guestpath += data
@@ -0,0 +1,35 @@
1
+ module Vagrant
2
+ module Util
3
+ module ANSIEscapeCodeRemover
4
+ # Removes ANSI escape code sequences from the text and returns
5
+ # it.
6
+ #
7
+ # This removes all the ANSI escape codes listed here along with
8
+ # the escape codes for VT100 terminals:
9
+ #
10
+ # http://ascii-table.com/ansi-escape-sequences.php
11
+ def remove_ansi_escape_codes(text)
12
+ # An array of regular expressions which match various kinds
13
+ # of escape sequences. I can't think of a better single regular
14
+ # expression or any faster way to do this.
15
+ matchers = [/\e\[\d*[ABCD]/, # Matches things like \e[4D
16
+ /\e\[(\d*;)?\d*[HF]/, # Matches \e[1;2H or \e[H
17
+ /\e\[(s|u|2J|K)/, # Matches \e[s, \e[2J, etc.
18
+ /\e\[(\d*;){0,2}\d*m/, # Matches color escapes: \e[32m
19
+ /\e\[=\d*[hl]/, # Matches \e[=24h
20
+ /\e\[\?[1-9][hl]/, # Matches \e[?2h
21
+ /\e\[20[hl]/, # Matches \e[20l]
22
+ /\e[DME78H]/, # Matches \eD, \eH, etc.
23
+ /\e\[[0-2]?[JK]/, # Matches \e[0J, \e[K, etc.
24
+ ]
25
+
26
+ # Take each matcher and replace it with emptiness.
27
+ matchers.each do |matcher|
28
+ text.gsub!(matcher, "")
29
+ end
30
+
31
+ text
32
+ end
33
+ end
34
+ end
35
+ 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.9.2"
5
+ VERSION = "0.9.3"
6
6
  end
@@ -30,6 +30,11 @@ en:
30
30
  An invalid option was specified. The help for this command
31
31
  is available below.
32
32
 
33
+ %{help}
34
+ cli_invalid_usage: |-
35
+ This command was not invoked properly. The help for this command is
36
+ available below.
37
+
33
38
  %{help}
34
39
  config_validation: |-
35
40
  There was a problem with the configuration of Vagrant. The error message(s)
@@ -25,10 +25,11 @@ describe Vagrant::Config::Base do
25
25
 
26
26
  it "doesn't merge values that start with a double underscore" do
27
27
  bar_class = Class.new(foo_class) do
28
- @@counter = 0
28
+ class_variable_set(:@@counter, 0)
29
+
29
30
  def initialize
30
- @__test = @@counter
31
- @@counter += 1
31
+ @__test = self.class.send(:class_variable_get, :@@counter)
32
+ self.class.send(:class_variable_set, :@@counter, @__test + 1)
32
33
  end
33
34
  end
34
35
 
@@ -0,0 +1,17 @@
1
+ require File.expand_path("../../../base", __FILE__)
2
+
3
+ require "vagrant/util/ansi_escape_code_remover"
4
+
5
+ describe Vagrant::Util::ANSIEscapeCodeRemover do
6
+ let(:klass) do
7
+ Class.new do
8
+ extend Vagrant::Util::ANSIEscapeCodeRemover
9
+ end
10
+ end
11
+
12
+ it "should remove ANSI escape codes" do
13
+ klass.remove_ansi_escape_codes("\e[Hyo").should == "yo"
14
+ klass.remove_ansi_escape_codes("\e[38myo").should == "yo"
15
+ end
16
+ end
17
+
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.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mitchell Hashimoto
@@ -376,6 +376,7 @@ files:
376
376
  - lib/vagrant/test_helpers.rb
377
377
  - lib/vagrant/ui.rb
378
378
  - lib/vagrant/util.rb
379
+ - lib/vagrant/util/ansi_escape_code_remover.rb
379
380
  - lib/vagrant/util/busy.rb
380
381
  - lib/vagrant/util/counter.rb
381
382
  - lib/vagrant/util/file_checksum.rb
@@ -535,6 +536,7 @@ files:
535
536
  - test/unit/vagrant/environment_test.rb
536
537
  - test/unit/vagrant/hosts_test.rb
537
538
  - test/unit/vagrant/registry_test.rb
539
+ - test/unit/vagrant/util/ansi_escape_code_remover_test.rb
538
540
  - test/unit/vagrant/util/file_checksum_test.rb
539
541
  - test/unit/vagrant/util/hash_with_indifferent_access_test.rb
540
542
  - test/unit/vagrant/util/network_ip_test.rb