vagrant-goodhosts 1.0.15 → 1.0.16

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
  SHA256:
3
- metadata.gz: 00dc15e9dc6876fb9f1610777d190e21c6bf6397531950a1cae0f35496e1e989
4
- data.tar.gz: 30f87a2f1855fde5e646148f02f1861d400de9054109920302e04ab29b95b353
3
+ metadata.gz: 6843d62e56a2bd4b265a0b4854bcb69fba17c99b60515ad4bdb23ef1decf384b
4
+ data.tar.gz: dfb62145d87e3d1d3122a6777399d3fb41c620df68f762ed6284c3221066e72b
5
5
  SHA512:
6
- metadata.gz: b9fd306e3cbff7ad32f524ba17f3248b1b5fdd113e59e341f34deb153f52c39212c1da1b97382d78567101e6edf74b1b1559180a3bdfbcadf3cabb7786c8edad
7
- data.tar.gz: 908da7239733a24b072256659e453d3864c429306b42f3128a6856e7013b635e0c922d3436c5c4ef902c43c9935f1a91f247fa7a0a0b68c1daab8531d931b4d1
6
+ metadata.gz: 9476f2832c25de5c268f2bcbda6f243f784ed641143c8a5b26fd0511582e9cbd010ff99faa96f53084699c16970a9efb71964309914f4d4e4847dacae2392346
7
+ data.tar.gz: 583d8ccf7c2c5e77feed7980987facb0fe156e1325efd580d19c20518cea2141a4b80e6cb18d8f15a550f945099c9c37755c13dc703d44e72c60b14c30e75104
data/README.md CHANGED
@@ -30,7 +30,7 @@ You currently only need the `hostname` and a `:private_network` network with a f
30
30
 
31
31
  ```ruby
32
32
  config.vm.network :private_network, ip: "192.168.3.10"
33
- config.vm.hostname = "www.testing.de"
33
+ config.vm.hostname = "www.testing.de" # This is not used by the plugin
34
34
  config.goodhosts.aliases = ["alias.testing.de", "alias2.somedomain.com"]
35
35
  ```
36
36
 
@@ -26,9 +26,10 @@ module VagrantPlugins
26
26
  # machines and having a static flag will result in a plugin being
27
27
  # executed just once.
28
28
  # https://github.com/goodhosts/vagrant/issues/30
29
- if not @@completed.key?(@machine.name)
29
+ @@completed[@machine.name] = [] unless @@completed.key?(@machine.name)
30
+ unless @@completed[@machine.name].include? self.class.name
30
31
  run(env)
31
- @@completed[@machine.name] = true
32
+ @@completed[@machine.name] << self.class.name
32
33
  end
33
34
 
34
35
  @app.call(env)
@@ -5,15 +5,15 @@ module VagrantPlugins
5
5
 
6
6
  def run(env)
7
7
  machine_action = env[:machine_action]
8
- if machine_action != :destroy || !@machine.id
9
- if machine_action != :suspend || false != @machine.config.goodhosts.remove_on_suspend
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"
15
- end
16
- end
8
+
9
+ return unless @machine.id
10
+ return unless [:destroy, :halt, :suspend].include? machine_action
11
+
12
+ if ([:halt, :suspend].include? machine_action) && (false == @machine.config.goodhosts.remove_on_suspend)
13
+ @ui.info "[vagrant-goodhosts] Removing hosts on suspend disabled"
14
+ else
15
+ @ui.info "[vagrant-goodhosts] Removing hosts"
16
+ removeHostEntries
17
17
  end
18
18
  end
19
19
 
@@ -184,7 +184,7 @@ module VagrantPlugins
184
184
  if ips.count() > 1
185
185
  ips.each do |ip|
186
186
  ip_address = ip
187
- if hostnames[ip].count() > 1
187
+ if hostnames[ip].count() > 0
188
188
  hostnames[ip].each do |hostname|
189
189
  if !ip_address.nil?
190
190
  @ui.info "[vagrant-goodhosts] - found entry for: #{ip_address} #{hostname}"
@@ -195,7 +195,7 @@ module VagrantPlugins
195
195
  end
196
196
  else
197
197
  ip_address = ips[0]
198
- if hostnames[ip_address].count() > 1
198
+ if hostnames[ip_address].count() > 0
199
199
  hostnames[ip_address].each do |hostname|
200
200
  if !ip_address.nil?
201
201
  @ui.info "[vagrant-goodhosts] - found entry for: #{ip_address} #{hostname}"
@@ -9,6 +9,7 @@ module VagrantPlugins
9
9
  attr_accessor :disable_clean
10
10
 
11
11
  def initialize
12
+ @remove_on_suspend = true
12
13
  @disable_clean = true
13
14
  end
14
15
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module GoodHosts
3
- VERSION = '1.0.15'
3
+ VERSION = '1.0.16'
4
4
  end
5
5
  end
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.15
4
+ version: 1.0.16
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-04-19 00:00:00.000000000 Z
11
+ date: 2021-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler