vagrant-hostsupdater 0.0.6 → 0.0.7
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 +4 -4
- data/README.md +4 -0
- data/lib/vagrant-hostsupdater/HostsUpdater.rb +14 -13
- data/lib/vagrant-hostsupdater/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 092e9d19e52604448eef2935325883f9f9a1406d
|
4
|
+
data.tar.gz: df0ef378226ef4c9bdb7194546f0a8dee36aad0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5403a44f9eb9389019bcfbf947b0df3a1b64abc0de2b6f7fe8f6abdfbfa2d5b0896cb1c11287b26a5baec29ce1b0e70085865abbe04c285d09fccfa47701ec45
|
7
|
+
data.tar.gz: fc3bf266de0209b090151fa7dcfa56a7339da8e5e6a101fa8239d10ae667e0670f1266683604df1a1d2bf49415a5f26fd315ba7b08d9d8ea7f79854afa08c4c7
|
data/README.md
CHANGED
@@ -11,6 +11,10 @@ By setting the remove\_on\_suspend option, you can have them removed on **suspen
|
|
11
11
|
|
12
12
|
## Versions
|
13
13
|
|
14
|
+
### 0.0.7
|
15
|
+
* using hashed uids now to identify hosts entries (you might need to remove previous hostentries manually)
|
16
|
+
* fixed removing of host entries
|
17
|
+
|
14
18
|
### 0.0.6
|
15
19
|
* no sudo, if /etc/hosts is writeable
|
16
20
|
|
@@ -56,17 +56,9 @@ module VagrantPlugins
|
|
56
56
|
file = File.open("/etc/hosts", "rb")
|
57
57
|
hostsContents = file.read
|
58
58
|
uuid = @machine.id
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
if hostsContents.match(/#{escapedId}/)
|
63
|
-
puts "removing uids"
|
64
|
-
puts "#{removeFromHosts}"
|
65
|
-
if !File.writable?("/etc/hosts")
|
66
|
-
sudo(removeFromHosts)
|
67
|
-
else
|
68
|
-
removeFromHosts
|
69
|
-
end
|
59
|
+
hashedId = Digest::MD5.hexdigest(uuid)
|
60
|
+
if hostsContents.match(/#{hashedId}/)
|
61
|
+
removeFromHosts
|
70
62
|
end
|
71
63
|
end
|
72
64
|
|
@@ -92,13 +84,22 @@ module VagrantPlugins
|
|
92
84
|
def removeFromHosts(options = {})
|
93
85
|
hosts_path = '/etc/hosts'
|
94
86
|
uuid = @machine.id
|
95
|
-
|
87
|
+
hashedId = Digest::MD5.hexdigest(uuid)
|
88
|
+
if !File.writable?("/etc/hosts")
|
89
|
+
sudo(%Q(sed -i -e '/#{hashedId}/ d' #{hosts_path}))
|
90
|
+
else
|
91
|
+
output = `sed -e "/#{hashedId}/ d" #{hosts_path}`
|
92
|
+
hostsFile = File.open(hosts_path, "w")
|
93
|
+
hostsFile.write(output)
|
94
|
+
hostsFile.close()
|
95
|
+
end
|
96
96
|
end
|
97
97
|
|
98
98
|
|
99
99
|
|
100
100
|
def signature(name, uuid = self.uuid)
|
101
|
-
|
101
|
+
hashedId = Digest::MD5.hexdigest(uuid)
|
102
|
+
%Q(# VAGRANT: #{hashedId} (#{name}) / #{uuid})
|
102
103
|
end
|
103
104
|
|
104
105
|
def sudo(command)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-hostsupdater
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Falk K\xC3\xBChnel"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-18 00:00:00 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
prerelease: false
|