vagrant-auto_network 1.0.1 → 1.0.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: 54c4da4f0bee53e5b39ea4bd507e11166a7b56e0
4
- data.tar.gz: a35c80d6ad5fe095c669ab317f997717e382077b
3
+ metadata.gz: b33ef5651e937a70d5b47f134bb044657b29050f
4
+ data.tar.gz: b380e2b4e66c9b56d8739286c991acca807b2cc4
5
5
  SHA512:
6
- metadata.gz: 65765f2eec79a431f740eeb2ad805f513eaa2eee7d35da0c98a0881c0a369e8fd5654715cdebf838d74c2d0e25b170a151ff46d77655ba1cb1c2253ad454ae0b
7
- data.tar.gz: 9227ad6e275f71921a88019851773e86f8bdffec965555e3d525df221293c9cb507efe01de936a0e4a485015cc2cac8579623badad469f0d6e90c75a28026875
6
+ metadata.gz: b1b9b251483b01f3bbd21739c55b030ba22e1b3e6c2bdfecc5601c23d2ab05b4ff34bea6bd8679043c903432fbf373d79226a39807a6a0ee409c870ef43c02f2
7
+ data.tar.gz: 79032d6d2960a87fb6038868b0819715e7a56b533faf19bcedc5a3bfb4709306cbcb171a20bd42af4d800e0d615baf3214973cbb44b6438a00b97458e16ba0c3
data/CHANGELOG CHANGED
@@ -1,6 +1,18 @@
1
1
  vagrant-auto_network
2
2
  ====================
3
3
 
4
+ 1.0.2
5
+ -----
6
+
7
+ 2014-06-21
8
+
9
+ This is a backwards compatible bugfix release.
10
+
11
+ * (GH-24) Fix improper allocations of IP addresses to machines that are not
12
+ using AutoNetwork. This regression was caused by the fix for GH-23 released
13
+ in version 1.0.1.
14
+
15
+
4
16
  1.0.1
5
17
  -----
6
18
 
@@ -16,10 +16,17 @@ class AutoNetwork::Action::Request < AutoNetwork::Action::Base
16
16
  @env = env
17
17
 
18
18
  machine = @env[:machine]
19
+ auto_networks = machine_auto_networks(machine)
19
20
 
20
- # Move along if this machine has no AutoNetwork interfaces.
21
- @app.call(@env) if machine_auto_networks(machine).empty?
21
+ # Do nothing if there are no private networks using :auto_network => true
22
+ filter_networks(machine, auto_networks) unless auto_networks.empty?
22
23
 
24
+ @app.call(@env)
25
+ end
26
+
27
+ private
28
+
29
+ def filter_networks(machine, networks)
23
30
  addr = AutoNetwork.active_pool_manager.address_for(machine)
24
31
  if addr.nil?
25
32
  addr = AutoNetwork.active_pool_manager.request(machine)
@@ -27,15 +34,7 @@ class AutoNetwork::Action::Request < AutoNetwork::Action::Base
27
34
  :prefix => true
28
35
  end
29
36
 
30
- filter_networks(machine, addr)
31
-
32
- @app.call(@env)
33
- end
34
-
35
- private
36
-
37
- def filter_networks(machine, addr)
38
- machine_auto_networks(machine).each do |net|
37
+ networks.each do |net|
39
38
  filter_private_network(net, addr)
40
39
  end
41
40
  end
@@ -11,11 +11,12 @@ module AutoNetwork
11
11
  DESC
12
12
 
13
13
  action_hook('Auto network: filter private networks', :environment_load) do |hook|
14
- load_pool = AutoNetwork::Action::LoadPool
14
+ pool_loader = Vagrant::Action::Builder.new.tap do |b|
15
+ b.use AutoNetwork::Action::LoadPool
16
+ b.use AutoNetwork::Action::FilterNetworks
17
+ end
15
18
 
16
- # TODO: This should be re-factored to use ActionBuilder.
17
- hook.prepend(load_pool)
18
- hook.after(load_pool, AutoNetwork::Action::FilterNetworks)
19
+ hook.prepend(pool_loader)
19
20
  end
20
21
 
21
22
  action_hook('Auto network: request address') do |hook|
@@ -1,3 +1,3 @@
1
1
  module AutoNetwork
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
@@ -68,5 +68,17 @@ describe AutoNetwork::Plugin do
68
68
  expect(network_opts).to include(:ip => '10.20.1.4')
69
69
  end
70
70
  end
71
+
72
+ context 'on a machine with no AutoNetwork networks' do
73
+ it 'does not allocate an IP address' do
74
+ env = test_env.create_vagrant_env
75
+ test_machine = env.machine(:plain, :dummy)
76
+
77
+ action_env = { :machine => test_machine }
78
+ env.action_runner.run(subject, action_env)
79
+
80
+ expect(current_ip(test_machine)).to be_nil
81
+ end
82
+ end
71
83
  end
72
84
  end
@@ -53,6 +53,10 @@ shared_context 'auto_network integration' do
53
53
  # - test3 has an allocated IP, but no ID.
54
54
  test_env.vagrantfile <<-EOF
55
55
  Vagrant.configure("2") do |config|
56
+ # Normal vanilla node.
57
+ config.vm.define 'plain'
58
+
59
+ # Test nodes with AutoNetwork enabled.
56
60
  %w[test1 test2 test3].each do |machine|
57
61
  config.vm.define machine do |node|
58
62
  node.vm.network :private_network, :auto_network => true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-auto_network
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrien Thebo
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-06 00:00:00.000000000 Z
12
+ date: 2014-06-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake