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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c1d2926742ca09d2235e4ac8fdf5a33fe94846e
4
- data.tar.gz: 760e89721aa455da912be1f2682787804f3e2404
3
+ metadata.gz: d1a0b966e30f8a8843acff919b09a657a7707538
4
+ data.tar.gz: b9a2e41d972abc6e3b32203ef6a3d41c4718fb47
5
5
  SHA512:
6
- metadata.gz: f0b2e8dd132e338ed6f6fc6ae7128294e35f631147f205546d7546321ff4df23006b25cfc3761ea6d894d5930dc091b2eddf13c049d5ab989887a8973d2106ff
7
- data.tar.gz: f2e82fa6d3a1e7ac99a479a16af820d0bd554b1f42f6fd9e0d6aa7624a50132e4ae6f13858cf47f958512e3c58bf2dc36097ab0f86a4fd3d14f62dd9c19cfdd9
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.py"
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
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Dotvm
3
- VERSION = "0.17.0"
3
+ VERSION = "0.18.0"
4
4
  end
5
5
  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.17.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.py
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))