vagrant-goodhosts 1.0.18 → 1.0.19

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: 74e9466d2e64e39de992c9940235deb31e8d64fd4e17e92d8b271392306dcabf
4
- data.tar.gz: 918fb30d3de3daf04492cd8850d5cd1fc5bb2187f9a985f048b401301c527409
3
+ metadata.gz: 9df62f1e1e6994b0e268f5a4c70e05992d2aa8717359bc843468f7fe209d735c
4
+ data.tar.gz: 5de2dbc4f9eefe5dddfed6a74c8db799b9cf5fd8003d111ea5d47e6bb07d68d3
5
5
  SHA512:
6
- metadata.gz: 396c9ad919d3abaea678b2042f57a9ef02dac89d4212ceb5e18887c5be190ae86a3112fa28664fe6e7483fcf6f9e969eda012d891a4d828622b6fc15b671a050
7
- data.tar.gz: f1d14ef933bfe527f6d0297300abf1cc3ed9a87f542b1ac5dc0ff017c71a52b32203984e1c04d37988fdbbe1d4f99343255f9ced3dd3a750ec1ded7b06870231
6
+ metadata.gz: a80232c8572f03701db820c2ab9be2e37288ab1fa258381c35843ebfc68c121f844c1765b18c6c743c3f9b0da18014e5bc32d7dde6d3b91d03ed6c2de24cff44
7
+ data.tar.gz: 69f5149b8e73aaedabc0c4011bade5b0a12f1cda452603b230fef861e774f2fed5eec14ec311ec6157fa4ec4cdb925d292faaf1bc448e6c9fb6e766bee5aaf7b
@@ -92,38 +92,9 @@ module VagrantPlugins
92
92
  return true
93
93
  end
94
94
 
95
- def addHostEntries
96
- error = false
97
- errorText = ""
98
- cli = get_cli
99
- hostnames_by_ips = generateHostnamesByIps
100
-
101
- return if not hostnames_by_ips.any?
102
-
103
- @ui.info "[vagrant-goodhosts] Checking for host entries"
104
-
105
- hostnames_by_ips.each do |ip_address, hostnames|
106
- if ip_address.nil?
107
- @ui.error "[vagrant-goodhosts] Error adding some hosts, no IP was provided for the following hostnames: #{hostnames}"
108
- next
109
- end
110
-
111
- # filter out the hosts we've already added
112
- hosts_to_add = check_hostnames_to_add( ip_address, hostnames)
113
- next if not hosts_to_add.any?
114
-
115
- stdin, stdout, stderr, wait_thr = add_goodhost_entries(ip_address, hosts_to_add)
116
- if !wait_thr.value.success?
117
- error = true
118
- errorText = stderr.read.strip
119
- end
120
- end
121
- printReadme(error, errorText)
122
- end
123
-
124
- def check_hostnames_to_add(ip_address, hostnames)
95
+ def checkHostnamesToAdd(ip_address, hostnames)
125
96
  hostnames_to_add = Array.new
126
-
97
+ hostnames = hostnames.split
127
98
  # check which hostnames actually need adding
128
99
  hostnames.each do |hostname|
129
100
  begin
@@ -138,7 +109,7 @@ module VagrantPlugins
138
109
  return hostnames_to_add
139
110
  end
140
111
 
141
- def add_goodhost_entries(ip_address, hostnames)
112
+ def addGoodhostEntries(ip_address, hostnames)
142
113
  if cli.include? ".exe"
143
114
  clean = "\"--clean\","
144
115
  if disableClean(ip_address)
@@ -155,7 +126,7 @@ module VagrantPlugins
155
126
  return stdin, stdout, stderr, wait_thr
156
127
  end
157
128
 
158
- def removeHostEntries
129
+ def addHostEntries
159
130
  error = false
160
131
  errorText = ""
161
132
  cli = get_cli
@@ -163,7 +134,7 @@ module VagrantPlugins
163
134
 
164
135
  return if not hostnames_by_ips.any?
165
136
 
166
- @ui.info "[vagrant-goodhosts] Removing hosts"
137
+ @ui.info "[vagrant-goodhosts] Checking for host entries"
167
138
 
168
139
  hostnames_by_ips.each do |ip_address, hostnames|
169
140
  if ip_address.nil?
@@ -171,7 +142,11 @@ module VagrantPlugins
171
142
  next
172
143
  end
173
144
 
174
- stdin, stdout, stderr, wait_thr = remove_goodhost_entries(ip_address, hostnames)
145
+ # filter out the hosts we've already added
146
+ hosts_to_add = checkHostnamesToAdd(ip_address, hostnames)
147
+ next if not hosts_to_add.any?
148
+
149
+ stdin, stdout, stderr, wait_thr = addGoodhostEntries(ip_address, hosts_to_add)
175
150
  if !wait_thr.value.success?
176
151
  error = true
177
152
  errorText = stderr.read.strip
@@ -180,7 +155,7 @@ module VagrantPlugins
180
155
  printReadme(error, errorText)
181
156
  end
182
157
 
183
- def remove_goodhost_entries(ip_address, hostnames)
158
+ def removeGoodhostEntries(ip_address, hostnames)
184
159
  if cli.include? ".exe"
185
160
  clean = "\"--clean\","
186
161
  if disableClean(ip_address)
@@ -197,6 +172,31 @@ module VagrantPlugins
197
172
  return stdin, stdout, stderr, wait_thr
198
173
  end
199
174
 
175
+ def removeHostEntries
176
+ error = false
177
+ errorText = ""
178
+ cli = get_cli
179
+ hostnames_by_ips = generateHostnamesByIps
180
+
181
+ return if not hostnames_by_ips.any?
182
+
183
+ @ui.info "[vagrant-goodhosts] Removing hosts"
184
+
185
+ hostnames_by_ips.each do |ip_address, hostnames|
186
+ if ip_address.nil?
187
+ @ui.error "[vagrant-goodhosts] Error adding some hosts, no IP was provided for the following hostnames: #{hostnames}"
188
+ next
189
+ end
190
+
191
+ stdin, stdout, stderr, wait_thr = removeGoodhostEntries(ip_address, hostnames)
192
+ if !wait_thr.value.success?
193
+ error = true
194
+ errorText = stderr.read.strip
195
+ end
196
+ end
197
+ printReadme(error, errorText)
198
+ end
199
+
200
200
  def printReadme(error, errorText)
201
201
  if error
202
202
  cli = get_cli
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module GoodHosts
3
- VERSION = '1.0.18'
3
+ VERSION = '1.0.19'
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.18
4
+ version: 1.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniele Scasciafratte
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-11 00:00:00.000000000 Z
11
+ date: 2021-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,7 +67,7 @@ homepage: https://github.com/goodhosts/vagrant
67
67
  licenses:
68
68
  - MIT
69
69
  metadata: {}
70
- post_install_message:
70
+ post_install_message:
71
71
  rdoc_options: []
72
72
  require_paths:
73
73
  - lib
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  version: '0'
84
84
  requirements: []
85
85
  rubygems_version: 3.2.27
86
- signing_key:
86
+ signing_key:
87
87
  specification_version: 4
88
88
  summary: Enables Vagrant to update hosts file on the host machine with goodhosts
89
89
  test_files: []