vagrant-dotvm 0.17.0 → 0.18.0
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/lib/vagrant-dotvm/configinjecter.rb +1 -1
- data/lib/vagrant-dotvm/version.rb +1 -1
- data/utils/add_host.sh +10 -0
- metadata +2 -2
- data/utils/add_host.py +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1a0b966e30f8a8843acff919b09a657a7707538
|
4
|
+
data.tar.gz: b9a2e41d972abc6e3b32203ef6a3d41c4718fb47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a4d3f12fc65c246efd5a0d2e1be028642b21c295038da4893db71030cf9a51b5153250de99f34de6b797f3443fc1ec2d50d43561d71b6677f73a52f23fb5f86
|
7
|
+
data.tar.gz: b8c37706a997c8c55b8e190a8fffeb0b30121674cb695ade1df205f37051733fa38e2d24602c46c1190dc742edeb9e6efc834b45cec196c4a0e44f8745d471d8
|
@@ -61,7 +61,7 @@ module VagrantPlugins
|
|
61
61
|
|
62
62
|
machine_cfg[:hosts].each do |host|
|
63
63
|
machine.vm.provision "shell", run: "always" do |s|
|
64
|
-
s.path = File.dirname(__FILE__) + "/../../utils/add_host.
|
64
|
+
s.path = File.dirname(__FILE__) + "/../../utils/add_host.sh"
|
65
65
|
s.args = [host[:ip], host[:host]]
|
66
66
|
s.privileged = true
|
67
67
|
end
|
data/utils/add_host.sh
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
quote() {
|
2
|
+
sed 's/[]\.|$(){}?+*^]/\\&/g' <<< "$*"
|
3
|
+
}
|
4
|
+
|
5
|
+
ip="$1"
|
6
|
+
host="$2"
|
7
|
+
|
8
|
+
# Check whether specific IP has specific HOST, if not add entry.
|
9
|
+
egrep "^$(quote "$ip")\s+" /etc/hosts | cut -d' ' -f2- | egrep -q "(\s+|^)$(quote "$host")(\s+|$)"
|
10
|
+
[ $? -eq 0 ] || echo "$ip $host" >> /etc/hosts
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-dotvm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Krzysztof Magosa
|
@@ -66,7 +66,7 @@ files:
|
|
66
66
|
- lib/vagrant-dotvm/dotvm.rb
|
67
67
|
- lib/vagrant-dotvm/plugin.rb
|
68
68
|
- lib/vagrant-dotvm/version.rb
|
69
|
-
- utils/add_host.
|
69
|
+
- utils/add_host.sh
|
70
70
|
- utils/authorize_key.sh
|
71
71
|
- utils/setup_route.sh
|
72
72
|
- vagrant-dotvm.gemspec
|
data/utils/add_host.py
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
#! /usr/bin/env python
|
2
|
-
|
3
|
-
import sys
|
4
|
-
|
5
|
-
ip = sys.argv[1]
|
6
|
-
host = sys.argv[2]
|
7
|
-
|
8
|
-
with open('/etc/hosts') as fd:
|
9
|
-
for entry in fd:
|
10
|
-
entry = entry.strip()
|
11
|
-
|
12
|
-
# omit empty lines
|
13
|
-
if not entry:
|
14
|
-
continue
|
15
|
-
|
16
|
-
entry = [x.strip() for x in entry.split(' ', 1)]
|
17
|
-
entry[1] = [x.strip() for x in entry[1].split(' ')]
|
18
|
-
|
19
|
-
if entry[0] == ip and host in entry[1]:
|
20
|
-
sys.exit(0)
|
21
|
-
|
22
|
-
with open('/etc/hosts', 'a') as fd:
|
23
|
-
fd.write("{} {}\n".format(ip, host))
|