vagrant-plugin-dummy 0.0.4 → 0.0.5

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.
@@ -21,15 +21,40 @@ module VagrantPluginDummy
21
21
  end
22
22
 
23
23
  def ready?
24
- @machine = machine
25
- @logger.debug("Checking the status of NIC 0")
24
+ provider = @machine.provider_name.id2name
26
25
  # NOTE: There is no timeout here. We should probably have one...
27
- @nic_0_status = ''
28
- while @nic_0_status !~ /Up/ do
29
- @nic_0_status = @machine.provider.driver.execute('guestproperty', 'get', @machine.id, '/VirtualBox/GuestInfo/Net/0/Status') || ''
30
- @logger.debug("NIC 0 Status: "+ @nic_0_status)
26
+ if provider == 'virtualbox'
27
+ return ready_virtualbox?
28
+ elsif provider == 'vmware_workstation'
29
+ return ready_vmware_workstation?
31
30
  end
31
+ end
32
32
 
33
+ def ready_virtualbox?
34
+ @logger.debug("Checking the status of NIC 0")
35
+ nic_0_status = ''
36
+ while nic_0_status !~ /Up/ do
37
+ nic_0_status = @machine.provider.driver.execute('guestproperty', 'get', @machine.id, '/VirtualBox/GuestInfo/Net/0/Status') || ''
38
+ @logger.debug("NIC 0 Status: "+ nic_0_status)
39
+ end
40
+ return true
41
+ end
42
+
43
+ def ready_vmware_workstation?
44
+ @logger.debug("Checking if IP address is assigned")
45
+ ip = nil
46
+ while not ip do
47
+ ip = nil
48
+ begin
49
+ resp = @machine.provider.driver.send(:vmrun, *['getGuestIPAddress', @machine.id])
50
+ rescue Exception => e
51
+ @logger.warn(e.message)
52
+ else
53
+ m = /(?<ip>\d{1,3}\.\d{1,3}.\d{1,3}\.\d{1,3})/.match(resp.stdout)
54
+ ip = (resp.exit_code == 0 and m) ? m['ip'] : nil
55
+ end
56
+ @logger.debug("Machine IP: #{ip}")
57
+ end
33
58
  return true
34
59
  end
35
60
 
@@ -0,0 +1,19 @@
1
+ require 'log4r'
2
+
3
+ module VagrantPluginDummy
4
+ module Guest
5
+ module Cap
6
+ class ConfigureNetworks
7
+
8
+ @@logger = Log4r::Logger.new("vagrant_plugin_dummy::guest::cap::configure_networks")
9
+
10
+ def self.configure_networks(machine, networks)
11
+ @@logger.debug("networks: #{networks.inspect}")
12
+ @@logger.warn('This is just DUMMY method.')
13
+ @@logger.warn('You will need to manually configure the network adapter.')
14
+ exit(0)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -35,7 +35,8 @@ module VagrantPluginDummy
35
35
  end
36
36
 
37
37
  def configure_networks(networks)
38
- false
38
+ require_relative "guest/cap/configure_networks"
39
+ VagrantPluginDummy::Guest::Cap::ConfigureNetworks
39
40
  end
40
41
 
41
42
  # Vagrant 1.2.x compatibility methods
@@ -36,10 +36,10 @@ module VagrantPluginDummy
36
36
  # VagrantPluginDummy::Guest::Cap::ChangeHostName
37
37
  # end
38
38
  #
39
- # guest_capability(:windows, :configure_networks) do
40
- # require_relative "guest/cap/configure_networks"
41
- # VagrantPluginDummy::Guest::Cap::ConfigureNetworks
42
- # end
39
+ guest_capability(:dummy, :configure_networks) do
40
+ require_relative "guest/cap/configure_networks"
41
+ VagrantPluginDummy::Guest::Cap::ConfigureNetworks
42
+ end
43
43
  #
44
44
  # guest_capability(:windows, :halt) do
45
45
  # require_relative "guest/cap/halt"
@@ -1,3 +1,3 @@
1
1
  module VagrantPluginDummy
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-plugin-dummy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-19 00:00:00.000000000 Z
12
+ date: 2014-01-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -128,6 +128,7 @@ files:
128
128
  - spec/vagrant-windows/helper_spec.rb
129
129
  - Rakefile
130
130
  - Gemfile
131
+ - lib/vagrant-plugin-dummy/guest/cap/configure_networks.rb
131
132
  - lib/vagrant-plugin-dummy/guest/dummy.rb
132
133
  - lib/vagrant-plugin-dummy/version.rb
133
134
  - lib/vagrant-plugin-dummy/errors.rb