vagrant-dns 2.4.0 → 2.4.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b96bd995237133ab779883dc28ed8ac0ed8b2cb15b71c81c755bef68f93fc6bb
4
- data.tar.gz: 9ddc6a521a68af235a6626672e6d7089e330bfcc0445b2126e01f8f45f4ebf32
3
+ metadata.gz: 634350bb6858e837967286d76282adba60eae400e80ebf3009cda0a18a317d99
4
+ data.tar.gz: 3d5a633eb5f9c5ca06248f22f36b8df8d64dba5db1893cde3380bea6aaef6ea5
5
5
  SHA512:
6
- metadata.gz: dee69e1a9fb66bdb817a310a2e2daf049bab4c032f907f7220825feffac480dbdeb4356c412c59dd7bd2369f40b030e8b21576e0c21d7bfd6dd6d3460fc69d74
7
- data.tar.gz: d58f43351a8a12aa3f79e6bdb7c047f312b38714767a0c4d0e03c5e2e4a484c9bd11a57aec95d775f37e425ed6cda027af49b8c8cd66f38a84b5fb92bd8439bd
6
+ metadata.gz: cec812610ae743d812282ce1b1c58e7d05a04df46c1d3d5bc240a07d1c69ac83b572030e933fddf2d49cc446cf59ac17a561c0b41bcb348f027f238896f407e8
7
+ data.tar.gz: 31881bf472a679f21b4288890c825de4dc40bf635564f9ec569a1a6fe4c77513ab6f2c83de8c2df74ebf80d85fc8d3d27ceabc4ef70266501ce5773709eb05b1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 2.4.1 (2023-04-16)
2
+
3
+ * Fix plugin hooking for multi-machine setups. [GH-78]
4
+
1
5
  ## 2.4.0 (2023-04-11)
2
6
 
3
7
  * DHCP support. [GH-51]
@@ -1,3 +1,3 @@
1
1
  module VagrantDNS
2
- VERSION = "2.4.0"
2
+ VERSION = "2.4.1"
3
3
  end
data/lib/vagrant-dns.rb CHANGED
@@ -12,22 +12,6 @@ require "vagrant-dns/middlewares/config_down"
12
12
  require "vagrant-dns/middlewares/restart"
13
13
 
14
14
  module VagrantDNS
15
-
16
- # @private
17
- def self.hooks
18
- @hooks ||= []
19
- end
20
-
21
- # @private
22
- def self.hooked(name)
23
- hooks << name
24
- end
25
-
26
- # @private
27
- def self.hooked?(name)
28
- hooks.include?(name)
29
- end
30
-
31
15
  class Plugin < Vagrant.plugin("2")
32
16
  name "vagrant-dns"
33
17
 
@@ -41,21 +25,28 @@ module VagrantDNS
41
25
  end
42
26
 
43
27
  %w{machine_action_up machine_action_reload}.each do |action|
44
- action_hook("restart_vagarant_dns_on_#{action}", action) do |hook|
45
- unless VagrantDNS.hooked?(action)
46
- hook.append VagrantDNS::Middlewares::ConfigUp
47
- hook.append VagrantDNS::Middlewares::Restart
48
- VagrantDNS.hooked(action)
49
- end
28
+ action_hook("restart_vagarant_dns_on_#{action}", action) do |hook, *args|
29
+ hook_once VagrantDNS::Middlewares::ConfigUp, hook
30
+ hook_once VagrantDNS::Middlewares::Restart, hook
50
31
  end
51
32
  end
52
33
 
53
34
  action_hook("remove_vagrant_dns_config", "machine_action_destroy") do |hook|
54
- unless VagrantDNS.hooked?("remove_vagrant_dns_config")
55
- hook.append VagrantDNS::Middlewares::ConfigDown
56
- hook.append VagrantDNS::Middlewares::Restart
57
- VagrantDNS.hooked("remove_vagrant_dns_config")
58
- end
35
+ hook_once VagrantDNS::Middlewares::ConfigDown, hook
36
+ hook_once VagrantDNS::Middlewares::Restart, hook
37
+ end
38
+
39
+ # @private
40
+ def self.hook_once(middleware, hook)
41
+ return if hook.append_hooks.any? { |stack_item|
42
+ if stack_item.is_a?(Array)
43
+ stack_item.first == middleware
44
+ else
45
+ stack_item.middleware == middleware
46
+ end
47
+
48
+ }
49
+ hook.append middleware
59
50
  end
60
51
  end
61
52
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-dns
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Gilcher
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-04-11 00:00:00.000000000 Z
12
+ date: 2023-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: daemons