vagrant-dotvm 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f0db930d6a40bd79d357345fc1a7894a518802c
4
- data.tar.gz: c870d76bc7eec160fe1797b167015088dc4ae4af
3
+ metadata.gz: 1c1d2926742ca09d2235e4ac8fdf5a33fe94846e
4
+ data.tar.gz: 760e89721aa455da912be1f2682787804f3e2404
5
5
  SHA512:
6
- metadata.gz: 296b16570f1ba5931563c0fc9f2c4c3330ba9d986bc557503aa8bacd780a3f983ae31e11ca5abbe90f2a2511a344b9b596b920fbca6cc549ce98b18bdb047c1a
7
- data.tar.gz: e4adcc2af39bc9501943bdaa11736ee18cca1f4e6145d5bfd210375d40dff6cab0ece5b081569bc9df96f3dabb0171f0888e00e17216b7bea0a27ad1f72dcdd0
6
+ metadata.gz: f0b2e8dd132e338ed6f6fc6ae7128294e35f631147f205546d7546321ff4df23006b25cfc3761ea6d894d5930dc091b2eddf13c049d5ab989887a8973d2106ff
7
+ data.tar.gz: f2e82fa6d3a1e7ac99a479a16af820d0bd554b1f42f6fd9e0d6aa7624a50132e4ae6f13858cf47f958512e3c58bf2dc36097ab0f86a4fd3d14f62dd9c19cfdd9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 0.17.0
2
+ * Add ability to add entries to /etc/hosts in guest
3
+ * Ability to set custom options for VirtualBox
4
+ * Remove default setting for natdnshostresolver1
5
+
6
+ # 0.16.0
7
+ * Remove default settings so DotVm is more transparent
8
+
1
9
  # 0.15.1
2
10
  * Fix for natnet option
3
11
 
@@ -23,8 +23,11 @@ module VagrantPlugins
23
23
  vb.customize ["modifyvm", :id, "--memory", machine_cfg[:memory]] unless machine_cfg[:memory].nil?
24
24
  vb.customize ["modifyvm", :id, "--cpus", machine_cfg[:cpus]] unless machine_cfg[:cpus].nil?
25
25
  vb.customize ["modifyvm", :id, "--cpuexecutioncap", machine_cfg[:cpucap]] unless machine_cfg[:cpucap].nil?
26
- vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
27
26
  vb.customize ["modifyvm", :id, "--natnet1", machine_cfg[:natnet]] unless machine_cfg[:natnet].nil?
27
+
28
+ machine_cfg[:options][:virtualbox].each do |option|
29
+ vb.customize ["modifyvm", :id, option[:name], option[:value]]
30
+ end
28
31
  end
29
32
 
30
33
  machine_cfg[:networks].each do |net|
@@ -56,6 +59,14 @@ module VagrantPlugins
56
59
  end
57
60
  end
58
61
 
62
+ machine_cfg[:hosts].each do |host|
63
+ machine.vm.provision "shell", run: "always" do |s|
64
+ s.path = File.dirname(__FILE__) + "/../../utils/add_host.py"
65
+ s.args = [host[:ip], host[:host]]
66
+ s.privileged = true
67
+ end
68
+ end
69
+
59
70
  machine_cfg[:provision].each do |provision|
60
71
  machine.vm.provision provision[:type], run: provision[:run] do |p|
61
72
  if provision[:type] == "shell"
@@ -55,6 +55,7 @@ module VagrantPlugins
55
55
  :graceful_halt_timeout => coalesce(machine["graceful_halt_timeout"], Defaults::GRACEFUL_HALT_TIMEOUT),
56
56
  :post_up_message => machine["post_up_message"],
57
57
  :autostart => coalesce(machine["autostart"], true),
58
+ :hosts => [],
58
59
  :folders => [
59
60
  {
60
61
  :host => "%project.host%",
@@ -64,6 +65,9 @@ module VagrantPlugins
64
65
  :type => nil,
65
66
  }
66
67
  ],
68
+ :options => {
69
+ :virtualbox => [],
70
+ },
67
71
  }
68
72
  end
69
73
 
@@ -135,6 +139,22 @@ module VagrantPlugins
135
139
  }
136
140
  end
137
141
 
142
+ private
143
+ def parse_option(option)
144
+ {
145
+ :name => option["name"],
146
+ :value => option["value"],
147
+ }
148
+ end
149
+
150
+ private
151
+ def parse_host(host)
152
+ {
153
+ :ip => host["ip"],
154
+ :host => host["host"],
155
+ }
156
+ end
157
+
138
158
  public
139
159
  def parse(yaml)
140
160
  config = {
@@ -168,6 +188,14 @@ module VagrantPlugins
168
188
  item[:authorized_keys] << parse_authorized_key(key)
169
189
  end
170
190
 
191
+ machine["options"].to_h["virtualbox"].to_a.each do |option|
192
+ item[:options][:virtualbox] << parse_option(option)
193
+ end
194
+
195
+ machine["hosts"].to_a.each do |host|
196
+ item[:hosts] << parse_host(host)
197
+ end
198
+
171
199
  config[:machines] << item
172
200
  end
173
201
 
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Dotvm
3
- VERSION = "0.16.0"
3
+ VERSION = "0.17.0"
4
4
  end
5
5
  end
data/utils/add_host.py ADDED
@@ -0,0 +1,23 @@
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))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-dotvm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Magosa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-12 00:00:00.000000000 Z
11
+ date: 2015-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +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
70
  - utils/authorize_key.sh
70
71
  - utils/setup_route.sh
71
72
  - vagrant-dotvm.gemspec