vagrant-veertu 0.0.15 → 0.0.17

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: e3bb7fba0711390479da3fb382a57199a529185f
4
- data.tar.gz: 9957d516b85e7ecf0484c955598e271fe38c8bee
3
+ metadata.gz: 8749b3e460a27d0e11ca0b1d5e378a8d92a543da
4
+ data.tar.gz: a96b68cd601d190dd36639971536ccb2f8703ed6
5
5
  SHA512:
6
- metadata.gz: f7e8873e36590077513aa5765d065d149fc53ee3939662bd7e767ab40b367da3efcdcdbfa509dbfc6d9c1a94b848e3d5186e50573171fd02ab83f6794a99add8
7
- data.tar.gz: 5f7e18a06bf5ec55785b1b5ba6399a8f8b86237d338c21e0029a1c5d893909211236110aae825cfa8c2d800b70c7b4fb47608fe8daf25f3236ba71c9579ea938
6
+ metadata.gz: d8834be9d93f6d929e3bb5643efbe5ab09ca4aa7046aea0c8f8d23c810534b5e4c2323316566ecf6fd30733370a6512ce393acaa014c28a8a3d77d14dc694848
7
+ data.tar.gz: faabce040dd0064b1dba7f11ee4cb7ac5eac664cef8b1a13988f091a483b8d5e561848718c23006c20925c210c474f71bfac55504c4d87946f2afa67f8cd4cfa
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  group :development do
4
- gem "vagrant", git: "https://github.com/mitchellh/vagrant.git"
4
+ gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git", :tag => 'v1.8.6'
5
5
  end
6
6
 
7
7
  group :plugins do
@@ -115,7 +115,7 @@ module VagrantPlugins
115
115
  ))
116
116
  end
117
117
 
118
- #env[:machine].provider.driver.enable_adapters(adapters)
118
+ env[:machine].provider.driver.enable_adapters(adapters)
119
119
  end
120
120
 
121
121
  # Continue the middleware chain.
@@ -23,15 +23,26 @@ module VagrantPlugins
23
23
 
24
24
  # This flag is used to keep track of interrupted state (SIGINT)
25
25
  @interrupted = false
26
-
26
+ default_paths = ["/Applications/Veertu.app/Contents/SharedSupport/VeertuManage",
27
+ "/Applications/Veertu Desktop.app/Contents/SharedSupport/VeertuManage"]
27
28
  ini_file = File.expand_path("~/.veertu_config")
28
29
  if File.exist?(ini_file) then
29
30
  file = IniFile.load(ini_file)
30
31
  @veertumanage_path = file['VAGRANT']['manage_path']
32
+ else
33
+ default_paths.each do |veertu_path|
34
+ if File.exist?(veertu_path)
35
+ @veertumanage_path = veertu_path
36
+ break
37
+ end
38
+ end
31
39
  end
32
- @veertumanage_path ||= "/Applications/Veertu.app/Contents/SharedSupport/VeertuManage"
33
-
34
40
  @logger.info("VeertuManage path: #{@veertumanage_path}")
41
+ if !@veertumanage_path
42
+ raise Errors::VeertuManageNotFoundError
43
+ end
44
+
45
+
35
46
  end
36
47
 
37
48
  # Clears the forwarded ports that have been set on the virtual machine.
@@ -42,7 +42,7 @@ module VagrantPlugins
42
42
  ports.each do |options|
43
43
  name = options[:name]
44
44
  protocol = options[:protocol] || "tcp"
45
- host_ip = options[:hostip] || "0"
45
+ host_ip = options[:hostip] || "127.0.0.1"
46
46
  host_port = options[:hostport]
47
47
  guest_ip = options[:guestip] || ""
48
48
  guest_port = options[:guestport]
@@ -154,7 +154,7 @@ module VagrantPlugins
154
154
  end
155
155
 
156
156
  def read_network_interfaces
157
- return { '0' => {:type => :nat}}
157
+ return { '0' => {:type => :nat}, '1' => {:type => :bridged}}
158
158
  end
159
159
 
160
160
  def read_state
@@ -262,7 +262,7 @@ module VagrantPlugins
262
262
 
263
263
  def read_mac_address
264
264
  vm_describe = get_vm_describe(@uuid)
265
- network_cards = vm_describe["network cards"]
265
+ network_cards = vm_describe['hardware']["network cards"]
266
266
  if not network_cards
267
267
  return nil
268
268
  end
@@ -274,8 +274,60 @@ module VagrantPlugins
274
274
  puts network_card
275
275
  return network_card['mac address']
276
276
  end
277
+
278
+ def enable_adapters(adapters)
279
+ vm_describe = get_vm_describe(@uuid)
280
+ puts vm_describe
281
+ network_cards = vm_describe['hardware']["network cards"]
282
+ if network_cards.is_a?(Hash)
283
+ network_cards = [network_cards]
284
+ end
285
+ if network_cards.nil?
286
+ network_cards = []
287
+ end
288
+
289
+ puts adapters
290
+ network_cards.each do |net_card| # set our net cards to be desired type by config
291
+ adapter = adapters.pop()
292
+ set_card(net_card['card index'], adapter[:type])
293
+ end
294
+ adapters.each do |adapter| # in case there are more adapters - add them
295
+ add_card(adapter[:type])
296
+ end
297
+ end
277
298
  protected
278
299
 
300
+ def has_adapter?(network_cards, type)
301
+ type_str = type_symbol_to_veertu_str(type)
302
+ network_cards.each do |network_card|
303
+ if network_card['connection'] == type_str
304
+ return network_card['card index']
305
+ end
306
+ end
307
+ return nil
308
+ end
309
+
310
+ def add_card(type)
311
+ type_str = type_symbol_to_veertu_str(type)
312
+ response = execute('modify', @uuid, 'add', 'network_card', '--type', type_str)
313
+ @logger.info(response)
314
+ end
315
+
316
+ def set_card(index, type)
317
+ type_str = type_symbol_to_veertu_str(type)
318
+ response = execute('modify', @uuid, 'set', '--network', index, '--network-type', type_str)
319
+ @logger.info(response)
320
+ end
321
+
322
+ def type_symbol_to_veertu_str(type)
323
+ if type == :nat
324
+ return 'host'
325
+ elsif type == :bridged
326
+ return 'shared'
327
+ end
328
+ return 'disconnected'
329
+ end
330
+
279
331
  def get_vm_list()
280
332
  vms_json = execute("--machine-readable", "list", retryable: true)
281
333
  vms = JSON.parse(vms_json)
@@ -8,9 +8,7 @@ module VagrantPlugins
8
8
  def self.installed?
9
9
  Driver::Meta.new
10
10
  true
11
- rescue Vagrant::Errors::VeertuInvalidVersion
12
- return false
13
- rescue Vagrant::Errors::VeertuNotDetected
11
+ rescue Errors::VeertuManageNotFoundError
14
12
  return false
15
13
  end
16
14
 
@@ -19,10 +17,7 @@ module VagrantPlugins
19
17
  # version and all that, which checks for Veertu being present
20
18
  Driver::Meta.new
21
19
  true
22
- rescue Vagrant::Errors::VeertuInvalidVersion
23
- raise if raise_error
24
- return false
25
- rescue Vagrant::Errors::VeertuNotDetected
20
+ rescue Errors::VeertuManageNotFoundError
26
21
  raise if raise_error
27
22
  return false
28
23
  end
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module Veertu
3
- VERSION = "0.0.15"
3
+ VERSION = "0.0.17"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-veertu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Veertu Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-05 00:00:00.000000000 Z
11
+ date: 2016-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inifile