vagrant-goodhosts 1.0.12 → 1.0.13
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9078c31120178731d174a2aa15a12b957d3057e11816127c0f89a319c1c6a400
|
4
|
+
data.tar.gz: f6fb7224ef9ee4eca57a100eb8cafde6ef684eae61fa9aadbc1160554c6d36f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0456d61e925bbf2dbc232c4adbc3767c36722fd1f4708283201c9a654b5d972828b4cfb8c550d41b937da3fc960243f59d7e9bda8c8b4d5f8365aa1cad1db158
|
7
|
+
data.tar.gz: 91abd5a594aa8b79a605f9841725f394511907a477bf879a11cb5331d6ded560854cace147e21797c0350afed9aa44a80bae924c4caffc29a161c801b9ae2601
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module GoodHosts
|
3
|
+
module Action
|
4
|
+
class BaseAction
|
5
|
+
include GoodHosts
|
6
|
+
|
7
|
+
# Vagrant 2.2.14 has changed the hooks execution policy so they
|
8
|
+
# started to be triggered more than once (a lot actually) which
|
9
|
+
# is non-performant and floody. With this static property, we
|
10
|
+
# control the executions and allowing just one.
|
11
|
+
#
|
12
|
+
# - https://github.com/hashicorp/vagrant/issues/12070#issuecomment-732271918
|
13
|
+
# - https://github.com/hashicorp/vagrant/compare/v2.2.13..v2.2.14#diff-4d1af7c67af870f20d303c3c43634084bab8acc101055b2e53ddc0d07f6f64dcL176-L180
|
14
|
+
# - https://github.com/goodhosts/vagrant/issues/25
|
15
|
+
@@completed = {}
|
16
|
+
|
17
|
+
def initialize(app, env)
|
18
|
+
@app = app
|
19
|
+
@machine = env[:machine]
|
20
|
+
@ui = env[:ui]
|
21
|
+
end
|
22
|
+
|
23
|
+
def call(env)
|
24
|
+
if not @@completed.key?(self.class.name)
|
25
|
+
run(env)
|
26
|
+
@@completed[self.class.name] = true
|
27
|
+
end
|
28
|
+
|
29
|
+
@app.call(env)
|
30
|
+
end
|
31
|
+
|
32
|
+
def run(env)
|
33
|
+
raise NotImplementedError.new("Must be implemented!")
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -1,32 +1,20 @@
|
|
1
1
|
module VagrantPlugins
|
2
2
|
module GoodHosts
|
3
3
|
module Action
|
4
|
-
class RemoveHosts
|
5
|
-
include GoodHosts
|
6
|
-
@@updated = false
|
4
|
+
class RemoveHosts < BaseAction
|
7
5
|
|
8
|
-
def
|
9
|
-
@app = app
|
10
|
-
@machine = env[:machine]
|
11
|
-
@ui = env[:ui]
|
12
|
-
end
|
13
|
-
|
14
|
-
def call(env)
|
6
|
+
def run(env)
|
15
7
|
machine_action = env[:machine_action]
|
16
8
|
if machine_action != :destroy || !@machine.id
|
17
9
|
if machine_action != :suspend || false != @machine.config.goodhosts.remove_on_suspend
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
else
|
24
|
-
@ui.info "[vagrant-goodhosts] Removing hosts on suspend disabled"
|
25
|
-
end
|
10
|
+
if machine_action != :halt || false != @machine.config.goodhosts.remove_on_suspend
|
11
|
+
@ui.info "[vagrant-goodhosts] Removing hosts"
|
12
|
+
removeHostEntries
|
13
|
+
else
|
14
|
+
@ui.info "[vagrant-goodhosts] Removing hosts on suspend disabled"
|
26
15
|
end
|
27
16
|
end
|
28
17
|
end
|
29
|
-
@app.call(env)
|
30
18
|
end
|
31
19
|
|
32
20
|
end
|
@@ -1,24 +1,11 @@
|
|
1
|
-
require_relative "../GoodHosts"
|
2
1
|
module VagrantPlugins
|
3
2
|
module GoodHosts
|
4
3
|
module Action
|
5
|
-
class UpdateHosts
|
6
|
-
include GoodHosts
|
7
|
-
@@updated = false
|
4
|
+
class UpdateHosts < BaseAction
|
8
5
|
|
9
|
-
def
|
10
|
-
@
|
11
|
-
|
12
|
-
@ui = env[:ui]
|
13
|
-
end
|
14
|
-
|
15
|
-
def call(env)
|
16
|
-
unless @@updated
|
17
|
-
@@updated = true
|
18
|
-
@ui.info "[vagrant-goodhosts] Checking for host entries"
|
19
|
-
addHostEntries()
|
20
|
-
end
|
21
|
-
@app.call(env)
|
6
|
+
def run(env)
|
7
|
+
@ui.info "[vagrant-goodhosts] Checking for host entries"
|
8
|
+
addHostEntries()
|
22
9
|
end
|
23
10
|
|
24
11
|
end
|
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require_relative "GoodHosts"
|
2
|
+
require_relative "Action/BaseAction"
|
3
|
+
require_relative "Action/UpdateHosts"
|
4
|
+
require_relative "Action/RemoveHosts"
|
3
5
|
|
4
6
|
module VagrantPlugins
|
5
7
|
module GoodHosts
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-goodhosts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniele Scasciafratte
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- README.md
|
52
52
|
- Rakefile
|
53
53
|
- lib/vagrant-goodhosts.rb
|
54
|
+
- lib/vagrant-goodhosts/Action/BaseAction.rb
|
54
55
|
- lib/vagrant-goodhosts/Action/RemoveHosts.rb
|
55
56
|
- lib/vagrant-goodhosts/Action/UpdateHosts.rb
|
56
57
|
- lib/vagrant-goodhosts/GoodHosts.rb
|