vagrant-hosts 2.8.0 → 2.8.1

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: bc25e420c49e7f62fdb74de109d2d297bbcd04ef
4
- data.tar.gz: 84dc84eaf30ba2d749dd691568aabd97fe1bc8bb
3
+ metadata.gz: b3e9f58247879332b3031dceff8009a6e305642a
4
+ data.tar.gz: fdc56fdde18bceb36882a38c6a2511c238399806
5
5
  SHA512:
6
- metadata.gz: f5fa318724084c3ad5ba7323330ab0550cef794a8bedbde25eed798648a3987de7289e4d90f2d98a6542368bce6cb211326aef1d55120b04e9cf70b1fbde0a78
7
- data.tar.gz: 5576b69d80d8ea0c2f7338aead65a83142ccb3afb5d4782dda9555e50972dee7c310206ff8096a54fe6cefdea4bf2b768f7231010c8f3fb381fe7037a6b07065
6
+ metadata.gz: 7ed4b370ea69eb8192194357ccfd5dd2d8ff62faf8fa8e1683c53ba15aabfa4870d77d7635c36b110b728810318b6ebc8e248404153b9ade8b6684c8c063fbc0
7
+ data.tar.gz: 2250d47993c1bb57f64b6b8427a22b5e231835f8167454fc0c0b753f9f03c7c898257155b7d91622222c9010061e20bae35968f75ba03201f9f18c10ede06c28
@@ -2,6 +2,12 @@
2
2
  language: ruby
3
3
  sudo: false
4
4
  before_install:
5
+ # TODO: Remove along with all BUNDLER_VERSION hackery once support for
6
+ # Vagrant < 1.9 is dropped.
7
+ #
8
+ # Travis has taken to installing Bundler as a "default" gem which locks
9
+ # it down and makes it extremely frustrating to use a different version.
10
+ - "find /home/travis/.rvm/rubies -wholename '*default/bundler-*.gemspec' -delete"
5
11
  - gem install bundler --version $BUNDLER_VERSION
6
12
  install: bundle _${BUNDLER_VERSION}_ install --without development
7
13
  script: bundle _${BUNDLER_VERSION}_ exec rspec --color --format documentation
@@ -14,13 +20,13 @@ env:
14
20
 
15
21
  matrix:
16
22
  include:
17
- - rvm: 2.0.0
18
- env: TEST_VAGRANT_VERSION=v1.6.5 BUNDLER_VERSION=1.6.9
19
23
  - rvm: 2.0.0
20
24
  env: TEST_VAGRANT_VERSION=v1.7.4 BUNDLER_VERSION=1.10.5
21
-
22
- - rvm: 2.2.3
23
- env: TEST_VAGRANT_VERSION=v1.8.1 BUNDLER_VERSION=1.10.6
24
- - rvm: 2.2.3
25
- env: TEST_VAGRANT_VERSION=HEAD BUNDLER_VERSION=1.10.6
26
-
25
+ - rvm: 2.2.5
26
+ env: TEST_VAGRANT_VERSION=v1.8.7 BUNDLER_VERSION=1.12.5
27
+ - rvm: 2.3.4
28
+ env: TEST_VAGRANT_VERSION=v1.9.8 BUNDLER_VERSION=1.16.1
29
+ - rvm: 2.4.4
30
+ env: TEST_VAGRANT_VERSION=v2.0.4 BUNDLER_VERSION=1.16.1
31
+ - rvm: 2.4.4
32
+ env: TEST_VAGRANT_VERSION=HEAD BUNDLER_VERSION=1.16.1
data/CHANGELOG CHANGED
@@ -1,6 +1,30 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
+ 2.8.1
5
+ -----
6
+
7
+ 2018-05-02
8
+
9
+ This is a backwards compatible bugfix release.
10
+
11
+ * Added test coverage for Vagrant 1.9 and 2.0
12
+
13
+ * Deprecated support for vagrant versions earlier than 1.8. These will be
14
+ removed in the next major release.
15
+
16
+ * Hostnames are now resolved to IP addresses using the Addrinfo library
17
+ which wraps the system resolver. Previously the Resolv library was used
18
+ which is a pure-Ruby DNS resolver that did not pick up system-specific
19
+ configuration or behavior.
20
+
21
+ * Host synchronization is supported for FreeBSD, thanks to Brian Shumate.
22
+
23
+ * Errors that occur during host sync are now trapped and logged. This
24
+ means that an unreachable host will no longer block other operations
25
+ like `vagrant destroy`.
26
+
27
+
4
28
  2.8.0
5
29
  -----
6
30
 
data/Gemfile CHANGED
@@ -1,6 +1,8 @@
1
1
  source 'https://rubygems.org'
2
+ require 'rubygems/version'
2
3
 
3
- ENV['TEST_VAGRANT_VERSION'] ||= 'v1.8.1'
4
+ vagrant_branch = ENV['TEST_VAGRANT_VERSION'] || 'v2.0.4'
5
+ vagrant_version = nil
4
6
 
5
7
  # Wrapping gemspec in the :plugins group causes Vagrant 1.5 and newer to
6
8
  # automagically load this plugin during acceptance tests.
@@ -9,19 +11,30 @@ group :plugins do
9
11
  end
10
12
 
11
13
  group :development do
12
- gem 'yard', '~> 0.8.7'
14
+ gem 'yard', '~> 0.9.11'
13
15
  gem 'redcarpet'
14
16
  end
15
17
 
16
18
  group :test do
17
- if ENV['TEST_VAGRANT_VERSION'] == 'HEAD'
18
- gem 'vagrant', :github => 'mitchellh/vagrant', :branch => 'master'
19
+ case vagrant_branch
20
+ when /head/i
21
+ gem 'vagrant', :git => 'https://github.com/hashicorp/vagrant.git',
22
+ :branch => 'master'
19
23
  else
20
- gem 'vagrant', :github => 'mitchellh/vagrant', :tag => ENV['TEST_VAGRANT_VERSION']
24
+ vagrant_version = Gem::Version.new(vagrant_branch.sub(/^v/, ''))
25
+ gem 'vagrant', :git => 'https://github.com/hashicorp/vagrant.git',
26
+ :tag => vagrant_branch
21
27
  end
22
28
 
23
- # Pinned on 2/21/2016. Compatible with Vagrant 1.6.x, 1.7.x and 1.8.x.
24
- gem 'vagrant-spec', :github => 'mitchellh/vagrant-spec', :ref => '9bba7e1'
29
+ if vagrant_branch.match(/head/i) || (vagrant_version > Gem::Version.new('1.9.3'))
30
+ # Pinned on 4/11/2017. Compatible with Vagrant > 1.9.3.
31
+ gem 'vagrant-spec', :git => 'https://github.com/hashicorp/vagrant-spec.git',
32
+ :ref => '1d09951'
33
+ elsif vagrant_version
34
+ # Pinned on 12/10/2014. Compatible with Vagrant 1.6.x -- 1.9.3.
35
+ gem 'vagrant-spec', :git => 'https://github.com/hashicorp/vagrant-spec.git',
36
+ :ref => '1df5a3a'
37
+ end
25
38
  end
26
39
 
27
40
  eval_gemfile "#{__FILE__}.local" if File.exists? "#{__FILE__}.local"
@@ -0,0 +1,25 @@
1
+ require 'vagrant/version'
2
+ require 'rubygems/version'
3
+
4
+ # Check for deprecated Vagrant versions
5
+ module VagrantHosts::Action
6
+ class VersionCheck
7
+ MINIMUM_VERSION = '1.8.0'
8
+
9
+ def initialize(app, env)
10
+ @app = app
11
+ end
12
+
13
+ def call(env)
14
+ unless Gem::Version.new(Vagrant::VERSION) > Gem::Version.new(MINIMUM_VERSION)
15
+ env[:env].ui.warn I18n.t(
16
+ 'vagrant_hosts.action.version_check.deprecated_vagrant_version',
17
+ minimum_version: MINIMUM_VERSION,
18
+ vagrant_version: Vagrant::VERSION
19
+ )
20
+ end
21
+
22
+ @app.call(env)
23
+ end
24
+ end
25
+ end
@@ -1,5 +1,7 @@
1
- require 'resolv'
2
1
  require 'ipaddr'
2
+ require 'socket' # For Addrinfo
3
+
4
+ require 'vagrant/errors'
3
5
 
4
6
  module VagrantHosts::Addresses
5
7
 
@@ -11,6 +13,10 @@ module VagrantHosts::Addresses
11
13
  # @since 2.7.0
12
14
  CACHE ||= {}
13
15
 
16
+ class UnresolvableHostname < ::Vagrant::Errors::VagrantError
17
+ error_key(:unresolvable_hostname, 'vagrant_hosts.errors')
18
+ end
19
+
14
20
  private
15
21
 
16
22
  def all_hosts(config)
@@ -92,7 +98,16 @@ module VagrantHosts::Addresses
92
98
  host_provisioners(m).each do |p|
93
99
  imports.each do |k|
94
100
  next unless p.config.exports.has_key?(k)
95
- hosts.concat resolve_host_entries(p.config.exports[k], m)
101
+ begin
102
+ hosts.concat resolve_host_entries(p.config.exports[k], m)
103
+ rescue Vagrant::Errors::VagrantError => e
104
+ machine.ui.error I18n.t(
105
+ 'vagrant_hosts.errors.collection_failed',
106
+ :host => m.name.to_s,
107
+ :error_class => e.class,
108
+ :message => e.message
109
+ )
110
+ end
96
111
  end
97
112
  end
98
113
  end
@@ -184,9 +199,8 @@ module VagrantHosts::Addresses
184
199
  #
185
200
  # @param address [String] A string that might be an IP address or a hostname.
186
201
  #
187
- # @raise [IPAddr::InvalidAddressError] Raised when an invalid address is
188
- # supplied.
189
- # @raise [Resolv::ResolvError] When a hostname cannot be resolved to an IP.
202
+ # @raise [VagrantHosts::Addresses::UnresolvableHostname] If `address` is a
203
+ # maformed IP address or unresolvable hostname.
190
204
  #
191
205
  # @return [IPAddr] An IP address.
192
206
  #
@@ -195,8 +209,23 @@ module VagrantHosts::Addresses
195
209
  ip = begin
196
210
  IPAddr.new(address)
197
211
  rescue IPAddr::InvalidAddressError
198
- # Wasn't an IP address. Resolve it. The AWS provider does this.
199
- IPAddr.new(Resolv.getaddress(address))
212
+ nil
213
+ end
214
+
215
+ ip ||= begin
216
+ # Wasn't an IP address. Resolve it. The "@vagrant_ssh" returns a
217
+ # hostname instead of IP when the AWS provider is in use.
218
+ #
219
+ # NOTE: Name resolution is done using Ruby's Addrinfo instead of Resolv
220
+ # as Addrinfo always uses the system resolver library and thus picks up
221
+ # platform-specific behavior such as the OS X /etc/resolver/ directory.
222
+ IPAddr.new(Addrinfo.ip(address).ip_address)
223
+ rescue IPAddr::InvalidAddressError, SocketError
224
+ nil
225
+ end
226
+
227
+ if ip.nil?
228
+ raise UnresolvableHostname, address: address
200
229
  end
201
230
 
202
231
  ip
@@ -22,7 +22,7 @@ class VagrantHosts::Plugin < Vagrant.plugin(2)
22
22
 
23
23
  # Guest capabilities for vagrant-hosts
24
24
 
25
- [:darwin, :linux, :solaris, :solaris11].each do |os|
25
+ [:darwin, :freebsd, :linux, :solaris, :solaris11].each do |os|
26
26
  guest_capability(os, 'sync_hosts') do
27
27
  require_relative 'cap'
28
28
  VagrantHosts::Cap::SyncHosts::POSIX
@@ -35,7 +35,7 @@ class VagrantHosts::Plugin < Vagrant.plugin(2)
35
35
  end
36
36
 
37
37
 
38
- [:darwin, :linux, :solaris, :solaris11].each do |os|
38
+ [:darwin, :freebsd, :linux, :solaris, :solaris11].each do |os|
39
39
  guest_capability(os, 'network_facts') do
40
40
  require_relative 'cap'
41
41
  VagrantHosts::Cap::Facts::POSIX
@@ -52,6 +52,12 @@ class VagrantHosts::Plugin < Vagrant.plugin(2)
52
52
  VagrantHosts::Command
53
53
  end
54
54
 
55
+ # Internal action hooks
56
+ action_hook('Vagrant Hosts: vagrant version check', :environment_load) do |hook|
57
+ require 'vagrant-hosts/action/version_check'
58
+ hook.prepend VagrantHosts::Action::VersionCheck
59
+ end
60
+
55
61
  # ConfigBuilder tie-ins
56
62
 
57
63
  def self.config_builder_hook
@@ -1,3 +1,3 @@
1
1
  module VagrantHosts
2
- VERSION = '2.8.0'
2
+ VERSION = '2.8.1'.freeze
3
3
  end
@@ -3,6 +3,7 @@ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
3
3
  # Disable Vagrant autoloading so that other plugins defined in the Gemfile for
4
4
  # Acceptance tests are not loaded.
5
5
  ENV['VAGRANT_NO_PLUGINS'] = '1'
6
+ ENV['VAGRANT_DISABLE_PLUGIN_INIT'] = '1'
6
7
 
7
8
  # Load the vagrant-hosts plugin so that Provisioners and such can be found.
8
9
  require 'vagrant-hosts'
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ require 'vagrant-hosts/addresses'
4
+
5
+ describe 'VagrantHosts::Addresses' do
6
+ subject do
7
+ # A simple class which simulates inclusion of VagrantHosts::Addresses
8
+ Class.new do
9
+ include VagrantHosts::Addresses
10
+ # Expose private methods included above for testing.
11
+ public *self.private_instance_methods
12
+ end.new
13
+ end
14
+
15
+ describe '#resolve_ip' do
16
+ it 'raises an error when passed an unresolvable hostname' do
17
+ expect{ subject.resolve_ip('somewhere.bogusdomain') }.to \
18
+ raise_error(VagrantHosts::Addresses::UnresolvableHostname, /somewhere.bogusdomain/)
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,20 @@
1
1
  ---
2
2
  en:
3
- vagrant_hosts: {}
3
+ vagrant_hosts:
4
+ action:
5
+ version_check:
6
+ deprecated_vagrant_version: |-
7
+ The vagrant-hosts plugin has deprecated support for Vagrant
8
+ versions older than %{minimum_version}. Support for version %{vagrant_version}
9
+ will be removed in the next major release of the plugin.
10
+ errors:
11
+ unresolvable_hostname: |-
12
+ The hostname, %{address}, was not a valid IP address or resolvable hostname.
13
+ collection_failed: |-
14
+ An error of type %{error_class} occurred while collecting
15
+ host info from %{host}:
16
+
17
+ %{message}
18
+
19
+ If this was caused by a transient condition, then the next
20
+ sync should succeed.
@@ -12,9 +12,9 @@ Gem::Specification.new do |gem|
12
12
  Manage static DNS entries and configuration for Vagrant guests.
13
13
  EOD
14
14
 
15
- gem.authors = 'Adrien Thebo'
16
- gem.email = 'adrien@somethingsinistral.net'
17
- gem.homepage = 'https://github.com/adrienthebo/vagrant-hosts'
15
+ gem.authors = ['Adrien Thebo', 'Charlie Sharpsteen']
16
+ gem.email = ['adrien@somethingsinistral.net', 'source@sharpsteen.net']
17
+ gem.homepage = 'https://github.com/oscar-stack/vagrant-hosts'
18
18
 
19
19
  gem.has_rdoc = true
20
20
  gem.license = 'Apache 2.0'
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-hosts
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0
4
+ version: 2.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrien Thebo
8
+ - Charlie Sharpsteen
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2016-04-18 00:00:00.000000000 Z
12
+ date: 2018-05-02 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rake
@@ -40,7 +41,9 @@ dependencies:
40
41
  version: 2.14.0
41
42
  description: |2
42
43
  Manage static DNS entries and configuration for Vagrant guests.
43
- email: adrien@somethingsinistral.net
44
+ email:
45
+ - adrien@somethingsinistral.net
46
+ - source@sharpsteen.net
44
47
  executables: []
45
48
  extensions: []
46
49
  extra_rdoc_files: []
@@ -55,6 +58,7 @@ files:
55
58
  - README.markdown
56
59
  - Rakefile
57
60
  - lib/vagrant-hosts.rb
61
+ - lib/vagrant-hosts/action/version_check.rb
58
62
  - lib/vagrant-hosts/addresses.rb
59
63
  - lib/vagrant-hosts/cap.rb
60
64
  - lib/vagrant-hosts/cap/facts/base.rb
@@ -76,11 +80,12 @@ files:
76
80
  - lib/vagrant-hosts/version.rb
77
81
  - spec/integration/addresses_spec.rb
78
82
  - spec/spec_helper.rb
83
+ - spec/unit/addresses_spec.rb
79
84
  - spec/unit/config_spec.rb
80
85
  - tasks/spec.rake
81
86
  - templates/locales/en.yml
82
87
  - vagrant-hosts.gemspec
83
- homepage: https://github.com/adrienthebo/vagrant-hosts
88
+ homepage: https://github.com/oscar-stack/vagrant-hosts
84
89
  licenses:
85
90
  - Apache 2.0
86
91
  metadata: {}
@@ -100,9 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
105
  version: '0'
101
106
  requirements: []
102
107
  rubyforge_project:
103
- rubygems_version: 2.4.5.1
108
+ rubygems_version: 2.6.13
104
109
  signing_key:
105
110
  specification_version: 4
106
111
  summary: Manage static DNS on vagrant guests
107
112
  test_files: []
108
- has_rdoc: true