vagrant-vmware-dhcp 0.0.6 → 0.0.7

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: 41b94ee9258152c1f4876cd69480f2f5aaf86d34
4
- data.tar.gz: 9ca0e66e7f97bb066277bad8dccda536c8f2bf07
3
+ metadata.gz: e79948a505c5fd7198d8a4e30c31a85acfceea88
4
+ data.tar.gz: 1e7815abe6fd14a1a535fe7d415cb341fc87592e
5
5
  SHA512:
6
- metadata.gz: 669af463443c20509ea29e71cf05e1e904815e5fea53965da20741598754099188283c27d639723202f8a3500cd851be974002772dee726456bcedd508466c59
7
- data.tar.gz: c581d528b41c80c62f9523b3f3fe850abf62d700bbbe52a26062adad0a0ffce1e51945f45d75565f078fa61b68ffd55eb7f35f45a8c3f668d06b2045011cc92f
6
+ metadata.gz: 153746f190ba6ad0fb1a71e6310f230407f8fb82f48f66fa0e4ba0c1ad8555ec89025b34e46ecdc2992cb8dd91382723bb906a953898d61103c70a7ba8e9b654
7
+ data.tar.gz: 4e9b895b4eb3a02f56d0d7efd5f2f8ab5c45dc139c2b05fea877bc55171fdd41edf28d758db886d22bf86ecdae6a528d243b91368538c4f30bbb97f6f0dbdec9
@@ -16,9 +16,7 @@ module VagrantPlugins
16
16
  @env = env
17
17
 
18
18
  if @env[:machine]
19
- @logger.debug("In config_dhcp provider_name is #{@env[:machine].provider_name}")
20
-
21
- if (@env[:machine].provider_name == :vmware_fusion or @env[:machine].provider_name == :vmware_workstation) and @env[:machine].config.control_dhcp
19
+ if @env[:machine].provider_name == :vmware_fusion or @env[:machine].provider_name == :vmware_workstation
22
20
  configure_dhcp
23
21
  end
24
22
  end
@@ -105,10 +103,14 @@ module VagrantPlugins
105
103
  network_map.each {
106
104
  |mac, network|
107
105
 
108
- @env[:ui].info("Configuring DHCP for #{network[:ip]} on #{network[:vnet]}")
109
-
106
+ @logger.info("Pruning DHCP configuration for #{network[:ip]}")
110
107
  prune_dhcpd_conf(network)
111
- write_dhcpd_conf(network)
108
+
109
+ if machine.config.control_dhcp == true
110
+ @env[:ui].info("Configuring DHCP for #{network[:ip]} on #{network[:vnet]}")
111
+
112
+ write_dhcpd_conf(network)
113
+ end
112
114
  }
113
115
 
114
116
  trigger_dhcpd_update
@@ -25,6 +25,9 @@ module VagrantPlugins
25
25
 
26
26
  mac = network[:mac]
27
27
 
28
+ before = File.open(conf_location).read
29
+ @logger.debug("Before altering, dhcpd.conf content is #{before}")
30
+
28
31
  command = []
29
32
  command << "sudo" if !File.writable?(conf_location)
30
33
  command += [
@@ -36,6 +39,9 @@ module VagrantPlugins
36
39
  ]
37
40
 
38
41
  system(*command)
42
+
43
+ after = File.open(conf_location).read
44
+ @logger.debug("After, dhcpd.conf content is #{after}")
39
45
  end
40
46
 
41
47
  def write_dhcpd_conf(network)
@@ -25,6 +25,9 @@ module VagrantPlugins
25
25
 
26
26
  mac = network[:mac]
27
27
 
28
+ before = File.open(conf_location).read
29
+ @logger.debug("Before altering, dhcpd.conf content is #{before}")
30
+
28
31
  command = []
29
32
  command << "sudo" if !File.writable?(conf_location)
30
33
  command += [
@@ -36,6 +39,9 @@ module VagrantPlugins
36
39
  ]
37
40
 
38
41
  system(*command)
42
+
43
+ after = File.open(conf_location).read
44
+ @logger.debug("After, dhcpd.conf content is #{after}")
39
45
  end
40
46
 
41
47
  def write_dhcpd_conf(network)
@@ -29,7 +29,6 @@ module VagrantPlugins
29
29
  mac = network[:mac]
30
30
 
31
31
  before = File.open(conf_location).read
32
-
33
32
  @logger.debug("Before altering, dhcpd.conf content is #{before}")
34
33
 
35
34
  after = before.gsub(/^# VAGRANT-BEGIN: #{mac}.*^# VAGRANT-END: #{mac}\s+/m, '')
@@ -15,9 +15,7 @@ module VagrantPlugins
15
15
  @env = env
16
16
 
17
17
  if @env[:machine]
18
- machine = @env[:machine]
19
-
20
- if (@env[:machine].provider_name == :vmware_fusion or @env[:machine].provider_name == :vmware_workstation) and @env[:machine].config.control_dhcp
18
+ if (@env[:machine].provider_name == :vmware_fusion or @env[:machine].provider_name == :vmware_workstation)
21
19
  set_mac_address(@env)
22
20
  end
23
21
  end
@@ -39,7 +37,9 @@ module VagrantPlugins
39
37
 
40
38
  def mac_from_ip(ip)
41
39
  sha = Digest::SHA256.hexdigest ip
42
- mac = sha.scan(/.{12}/)[0]
40
+
41
+ # VMWare doesn't like odd values for the first octet.
42
+ mac = "AA" + sha.scan(/.{10}/)[0]
43
43
 
44
44
  mac
45
45
  end
@@ -19,12 +19,14 @@ module VagrantPlugins
19
19
  end
20
20
 
21
21
  action_hook('DA VMWare Network: Configure dhcp.conf') do |hook|
22
- if Vagrant::Util::Platform.windows?
22
+ if defined?(ActionClass) and defined?(ConfigDhcpClass)
23
+ # no-op
24
+ elsif Vagrant::Util::Platform.windows?
23
25
  ConfigDhcpClass = VagrantVmwareDhcp::Action::ConfigDhcpWindows
24
- ActionClass = HashiCorp::VagrantVMwaredesktop::Action::Network
26
+ ActionClass = HashiCorp::VagrantVMwareworkstation::Action::Network
25
27
  elsif Vagrant::Util::Platform.linux?
26
28
  ConfigDhcpClass = VagrantVmwareDhcp::Action::ConfigDhcpLinux
27
- ActionClass = HashiCorp::VagrantVMwaredesktop::Action::Network
29
+ ActionClass = HashiCorp::VagrantVMwareworkstation::Action::Network
28
30
  elsif Vagrant::Util::Platform.darwin?
29
31
  ConfigDhcpClass = VagrantVmwareDhcp::Action::ConfigDhcpDarwin
30
32
  ActionClass = HashiCorp::VagrantVMwarefusion::Action::Network
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module VagrantVmwareDhcp
3
- VERSION = '0.0.6'
3
+ VERSION = '0.0.7'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-vmware-dhcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Israel Shirk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-18 00:00:00.000000000 Z
11
+ date: 2015-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake