vagrant-goodhosts 1.0.2 → 1.0.8
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: e083ea939c0b8d617df7e7edd73baf1d56fa3b34898009596811ed7741fb7809
|
4
|
+
data.tar.gz: 5dc851d568aef47c267dcddfb6cdc4474887423c3d50a4904ce6b1536d57ca71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1da2f9460ac88dd0b98170cba82383d9cde45d9b55ee3f0ab70a8ad73a8ea1aab9204e6babf225a7508f63d566162e11115f2da0b2449a4272e38d8e1ca6cb4
|
7
|
+
data.tar.gz: be40aee11d67c11c296ae6be6570cc6331660fd15091f6731c2c2345b4274482f7fca353889a80421ba40b5918e845ad442c6785b64647f46e877847b007bc7e
|
@@ -36,12 +36,13 @@ module VagrantPlugins
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
|
39
|
+
|
40
40
|
end
|
41
|
+
return ips
|
41
42
|
end
|
42
43
|
|
43
44
|
# https://stackoverflow.com/a/13586108/1902215
|
44
|
-
def
|
45
|
+
def get_os_binary
|
45
46
|
return os ||= (host_os = RbConfig::CONFIG["host_os"]
|
46
47
|
case host_os
|
47
48
|
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
@@ -56,9 +57,9 @@ module VagrantPlugins
|
|
56
57
|
end
|
57
58
|
|
58
59
|
def get_cli
|
59
|
-
|
60
|
+
binary = get_os_binary
|
60
61
|
path = File.expand_path(File.dirname(File.dirname(__FILE__))) + "/vagrant-goodhosts/bundle/"
|
61
|
-
path = "#{path}#{
|
62
|
+
path = "#{path}#{binary}"
|
62
63
|
|
63
64
|
return path
|
64
65
|
end
|
@@ -80,15 +81,6 @@ module VagrantPlugins
|
|
80
81
|
end
|
81
82
|
end
|
82
83
|
|
83
|
-
# handle default hostname(s) if not already specified in the aliases
|
84
|
-
Array(@machine.config.vm.hostname).each do |host|
|
85
|
-
if hostnames.none? { |k, v| v.include?(host) }
|
86
|
-
ips.each do |ip|
|
87
|
-
hostnames[ip].unshift host
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
84
|
return hostnames
|
93
85
|
end
|
94
86
|
|
@@ -97,11 +89,15 @@ module VagrantPlugins
|
|
97
89
|
errorText = ""
|
98
90
|
cli = get_cli
|
99
91
|
hostnames_by_ips = generateHostnamesByIps
|
100
|
-
hostnames_by_ips.each do |
|
92
|
+
hostnames_by_ips.each do |ip_address, hostnames|
|
93
|
+
if ip_address.nil?
|
94
|
+
@ui.error "[vagrant-goodhosts] Error adding some hosts, no IP was provided for the following hostnames: #{hostnames}"
|
95
|
+
next
|
96
|
+
end
|
101
97
|
if cli.include? ".exe"
|
102
|
-
stdin, stdout, stderr, wait_thr = Open3.popen3(
|
98
|
+
stdin, stdout, stderr, wait_thr = Open3.popen3("powershell", "-Command", "Start-Process '#{cli}' -ArgumentList \"add\",\"--clean\",\"#{ip_address}\",\"#{hostnames}\" -Verb RunAs")
|
103
99
|
else
|
104
|
-
stdin, stdout, stderr, wait_thr = Open3.popen3("sudo", cli, "
|
100
|
+
stdin, stdout, stderr, wait_thr = Open3.popen3("sudo", cli, "add", "--clean", ip_address, hostnames)
|
105
101
|
end
|
106
102
|
if !wait_thr.value.success?
|
107
103
|
error = true
|
@@ -116,11 +112,15 @@ module VagrantPlugins
|
|
116
112
|
errorText = ""
|
117
113
|
cli = get_cli
|
118
114
|
hostnames_by_ips = generateHostnamesByIps
|
119
|
-
hostnames_by_ips.each do |
|
115
|
+
hostnames_by_ips.each do |ip_address, hostnames|
|
116
|
+
if ip_address.nil?
|
117
|
+
@ui.error "[vagrant-goodhosts] Error adding some hosts, no IP was provided for the following hostnames: #{hostnames}"
|
118
|
+
next
|
119
|
+
end
|
120
120
|
if cli.include? ".exe"
|
121
|
-
stdin, stdout, stderr, wait_thr = Open3.popen3(
|
121
|
+
stdin, stdout, stderr, wait_thr = Open3.popen3("powershell", "-Command", "Start-Process '#{cli}' -ArgumentList \"remove\",\"--clean\",\"#{ip_address}\",\"#{hostnames}\" -Verb RunAs")
|
122
122
|
else
|
123
|
-
stdin, stdout, stderr, wait_thr = Open3.popen3("sudo", cli, "
|
123
|
+
stdin, stdout, stderr, wait_thr = Open3.popen3("sudo", cli, "remove", "--clean", ip_address, hostnames)
|
124
124
|
end
|
125
125
|
if !wait_thr.value.success?
|
126
126
|
error = true
|
@@ -153,7 +153,7 @@ module VagrantPlugins
|
|
153
153
|
ip_address = ip
|
154
154
|
hostnames[ip].each do |hostname|
|
155
155
|
if !ip_address.nil?
|
156
|
-
@ui.info "[vagrant-goodhosts] -
|
156
|
+
@ui.info "[vagrant-goodhosts] - found entry for: #{ip_address} #{hostname}"
|
157
157
|
end
|
158
158
|
end
|
159
159
|
hostnames_by_ips = { ip_address => hostnames[ip].join(" ") }
|
@@ -162,7 +162,7 @@ module VagrantPlugins
|
|
162
162
|
ip_address = ips[0]
|
163
163
|
hostnames[ip_address].each do |hostname|
|
164
164
|
if !ip_address.nil?
|
165
|
-
@ui.info "[vagrant-goodhosts] -
|
165
|
+
@ui.info "[vagrant-goodhosts] - found entry for: #{ip_address} #{hostname}"
|
166
166
|
end
|
167
167
|
end
|
168
168
|
hostnames_by_ips = { ip_address => hostnames[ip_address].join(" ") }
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniele Scasciafratte
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
|
-
rubygems_version: 3.1
|
84
|
+
rubygems_version: 3.2.0.rc.1
|
85
85
|
signing_key:
|
86
86
|
specification_version: 4
|
87
87
|
summary: Enables Vagrant to update hosts file on the host machine with goodhosts
|