vagrant-goodhosts 1.0.0.pre.beta4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +47 -32
- data/lib/vagrant-goodhosts/GoodHosts.rb +8 -8
- data/lib/vagrant-goodhosts/plugin.rb +0 -5
- data/lib/vagrant-goodhosts/version.rb +1 -1
- data/vagrant-goodhosts.gemspec +1 -1
- metadata +5 -6
- data/lib/vagrant-goodhosts/command.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dae3311603bb8549e1be6f3eb18b46c0c0fd7b1fab7d6c43f42c190fac1dd907
|
4
|
+
data.tar.gz: 168d43266f469c5ba81ebac4ebe6933b0500123cf7809d7276567709bf794bf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 354b9a2a3945f1ebcf3ba8b7877d6e2bf553a14dcfbd85d140f81dda081fad7c1162eef5e354ad2024d516ac2b31b5641066ac8ff110737248be2699f8c42b04
|
7
|
+
data.tar.gz: 5a46c36236e3933caa25185420f2b055d2c01ae1f73236f5708e53f7f4cec4c45b90d11be1fe48cd219af5a349b23d33361781dc9fed83838ba32f45866093d6
|
data/README.md
CHANGED
@@ -1,32 +1,39 @@
|
|
1
1
|
# Vagrant::Goodhosts
|
2
2
|
|
3
|
-
This plugin adds
|
3
|
+
This vagrant plugin adds host file entries to the host pointing to the guest VM, using the [GoodHosts](https://github.com/goodhosts/cli) cli tool. This plugin is based on [vagrant-hostsupdater](https://github.com/cogitatio/vagrant-hostsupdater) and aims to be compatible with the same config parameters.
|
4
4
|
|
5
|
-
On **up**, **resume** and **reload** commands, it tries to add the
|
5
|
+
On **up**, **resume** and **reload** commands, it tries to add the hosts if they do not already exist in your hosts file. If it needs to be added, you will be asked for the `sudo` password to make the necessary edits.
|
6
6
|
|
7
|
-
On **halt**, **destroy**, and **suspend**, those entries will be removed again.
|
8
|
-
By setting the `config.goodhosts.remove_on_suspend = false`, **suspend** and **halt** will not remove them.
|
7
|
+
On **halt**, **destroy**, and **suspend**, those entries will be removed again. By setting the `config.goodhosts.remove_on_suspend = false`, **suspend** and **halt** will not remove them.
|
9
8
|
|
10
9
|
|
11
10
|
## Installation
|
12
11
|
|
13
|
-
|
12
|
+
```shell
|
13
|
+
vagrant plugin install vagrant-goodhosts
|
14
|
+
```
|
14
15
|
|
15
|
-
|
16
|
+
To uninstall :
|
16
17
|
|
17
|
-
|
18
|
+
```shell
|
19
|
+
vagrant plugin uninstall vagrant-goodhosts
|
20
|
+
```
|
18
21
|
|
19
|
-
|
22
|
+
To update the plugin:
|
20
23
|
|
21
|
-
|
24
|
+
```shell
|
25
|
+
vagrant plugin update vagrant-goodhosts
|
26
|
+
```
|
22
27
|
|
23
28
|
## Usage
|
24
29
|
|
25
30
|
You currently only need the `hostname` and a `:private_network` network with a fixed IP address.
|
26
31
|
|
27
|
-
|
28
|
-
|
29
|
-
|
32
|
+
```ruby
|
33
|
+
config.vm.network :private_network, ip: "192.168.3.10"
|
34
|
+
config.vm.hostname = "www.testing.de"
|
35
|
+
config.goodhosts.aliases = ["alias.testing.de", "alias2.somedomain.com"]
|
36
|
+
```
|
30
37
|
|
31
38
|
This IP address and the hostname will be used for the entry in the `/etc/hosts` file.
|
32
39
|
|
@@ -34,30 +41,38 @@ This IP address and the hostname will be used for the entry in the `/etc/hosts`
|
|
34
41
|
|
35
42
|
If you have multiple network adapters i.e.:
|
36
43
|
|
37
|
-
|
38
|
-
|
44
|
+
```ruby
|
45
|
+
config.vm.network :private_network, ip: "10.0.0.1"
|
46
|
+
config.vm.network :private_network, ip: "10.0.0.2"
|
47
|
+
```
|
39
48
|
|
40
|
-
|
49
|
+
You can specify which hostnames are bound to which IP by passing a hash mapping the IP of the network to an array of hostnames to create, e.g.:
|
41
50
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
51
|
+
```ruby
|
52
|
+
config.goodhosts.aliases = {
|
53
|
+
'10.0.0.1' => ['foo.com', 'bar.com'],
|
54
|
+
'10.0.0.2' => ['baz.com', 'bat.com']
|
55
|
+
}
|
56
|
+
```
|
46
57
|
|
47
58
|
This will produce `/etc/hosts` entries like so:
|
48
59
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
60
|
+
```
|
61
|
+
10.0.0.1 foo.com
|
62
|
+
10.0.0.1 bar.com
|
63
|
+
10.0.0.2 baz.com
|
64
|
+
10.0.0.2 bat.com
|
65
|
+
```
|
66
|
+
|
54
67
|
### Keeping Host Entries After Suspend/Halt
|
55
68
|
|
56
|
-
To keep your
|
69
|
+
To keep your `/etc/hosts` file unchanged simply add the line below to your `VagrantFile`:
|
57
70
|
|
58
|
-
|
59
|
-
|
60
|
-
|
71
|
+
```ruby
|
72
|
+
config.goodhosts.remove_on_suspend = false
|
73
|
+
```
|
74
|
+
|
75
|
+
This disables `vagrant-goodhosts` from running on **suspend** and **halt**.
|
61
76
|
|
62
77
|
|
63
78
|
## Suppressing prompts for elevating privileges
|
@@ -85,12 +100,12 @@ You have to open an elevated command prompt; hold `❖ Win` and press `X`, then
|
|
85
100
|
|
86
101
|
cacls %SYSTEMROOT%\system32\drivers\etc\hosts /E /G %USERNAME%:W
|
87
102
|
|
88
|
-
## Installing
|
103
|
+
## Installing The Development Version
|
89
104
|
|
90
|
-
If you would like to install vagrant-goodhosts
|
105
|
+
If you would like to install `vagrant-goodhosts` to make contributions or changes, run the following commands::
|
91
106
|
|
92
|
-
```
|
93
|
-
git clone https://github.com/goodhosts/vagrant
|
107
|
+
```shell
|
108
|
+
git clone https://github.com/goodhosts/vagrant vagrant-goodhosts
|
94
109
|
cd vagrant-goodhosts
|
95
110
|
git checkout develop
|
96
111
|
./package.sh
|
@@ -7,7 +7,7 @@ module VagrantPlugins
|
|
7
7
|
|
8
8
|
def getIps
|
9
9
|
if Vagrant.has_plugin?("vagrant-hostsupdater")
|
10
|
-
@ui.error "
|
10
|
+
@ui.error "[vagrant-goodhosts] Warning: The vagrant-hostsupdater plugin is installed, hostsupdater always adds the VM name even if the VagrantFile says not to. This shouldn't cause issues, but if it does, uninstall hostsupdater"
|
11
11
|
end
|
12
12
|
|
13
13
|
ips = []
|
@@ -22,7 +22,7 @@ module VagrantPlugins
|
|
22
22
|
|
23
23
|
@machine.config.vm.provider :hyperv do |v|
|
24
24
|
timeout = @machine.provider_config.ip_address_timeout
|
25
|
-
@ui.output("Waiting for the machine to report its IP address(might take some time, have
|
25
|
+
@ui.output("[vagrant-goodhosts] Waiting for the guest machine to report its IP address ( this might take some time, have patience )...")
|
26
26
|
@ui.detail("Timeout: #{timeout} seconds")
|
27
27
|
|
28
28
|
options = {
|
@@ -105,7 +105,7 @@ module VagrantPlugins
|
|
105
105
|
hostnames[ip].each do |hostname|
|
106
106
|
ip_address = ip
|
107
107
|
if !ip_address.nil?
|
108
|
-
@ui.info "[vagrant-goodhosts]
|
108
|
+
@ui.info "[vagrant-goodhosts] - found entry for: #{ip_address} #{hostname}"
|
109
109
|
if cli.include? ".exe"
|
110
110
|
stdin, stdout, stderr, wait_thr = Open3.popen3(cli, "a", ip_address, hostname)
|
111
111
|
else
|
@@ -131,7 +131,7 @@ module VagrantPlugins
|
|
131
131
|
hostnames[ip].each do |hostname|
|
132
132
|
ip_address = ip
|
133
133
|
if !ip_address.nil?
|
134
|
-
@ui.info "[vagrant-goodhosts]
|
134
|
+
@ui.info "[vagrant-goodhosts] - remove entry for: #{ip_address} #{hostname}"
|
135
135
|
if cli.include? ".exe"
|
136
136
|
stdin, stdout, stderr, wait_thr = Open3.popen3(cli, "r", ip_address, hostname)
|
137
137
|
else
|
@@ -150,11 +150,11 @@ module VagrantPlugins
|
|
150
150
|
def printReadme(error, errorText)
|
151
151
|
if error
|
152
152
|
cli = get_cli
|
153
|
-
@ui.error "[vagrant-goodhosts] Issue
|
154
|
-
@ui.error "[vagrant-goodhosts] Cli path: #{cli}"
|
155
|
-
@ui.error "[vagrant-goodhosts] Check the readme at https://github.com/
|
153
|
+
@ui.error "[vagrant-goodhosts] Issue executing goodhosts CLI: #{errorText}"
|
154
|
+
@ui.error "[vagrant-goodhosts] Cli path: #{cli}"
|
155
|
+
@ui.error "[vagrant-goodhosts] Check the readme at https://github.com/goodhosts/vagrant#passwordless-sudo"
|
156
156
|
end
|
157
|
-
|
157
|
+
|
158
158
|
end
|
159
159
|
|
160
160
|
end
|
data/vagrant-goodhosts.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ['mte90net@gmail.com']
|
11
11
|
spec.description = %q{Enables Vagrant to update hosts file on the host machine with goodhosts}
|
12
12
|
spec.summary = spec.description
|
13
|
-
spec.homepage = 'https://github.com/
|
13
|
+
spec.homepage = 'https://github.com/goodhosts/vagrant'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
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.0
|
4
|
+
version: 1.0.0
|
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-06-
|
11
|
+
date: 2020-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -57,13 +57,12 @@ files:
|
|
57
57
|
- lib/vagrant-goodhosts/bundle/cli
|
58
58
|
- lib/vagrant-goodhosts/bundle/cli.exe
|
59
59
|
- lib/vagrant-goodhosts/bundle/cli_osx
|
60
|
-
- lib/vagrant-goodhosts/command.rb
|
61
60
|
- lib/vagrant-goodhosts/config.rb
|
62
61
|
- lib/vagrant-goodhosts/plugin.rb
|
63
62
|
- lib/vagrant-goodhosts/version.rb
|
64
63
|
- package.sh
|
65
64
|
- vagrant-goodhosts.gemspec
|
66
|
-
homepage: https://github.com/
|
65
|
+
homepage: https://github.com/goodhosts/vagrant
|
67
66
|
licenses:
|
68
67
|
- MIT
|
69
68
|
metadata: {}
|
@@ -78,9 +77,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
77
|
version: '0'
|
79
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
79
|
requirements:
|
81
|
-
- - "
|
80
|
+
- - ">="
|
82
81
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
82
|
+
version: '0'
|
84
83
|
requirements: []
|
85
84
|
rubygems_version: 3.1.2
|
86
85
|
signing_key:
|