vagrant-vmware-dhcp 0.0.7 → 0.0.8

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: e79948a505c5fd7198d8a4e30c31a85acfceea88
4
- data.tar.gz: 1e7815abe6fd14a1a535fe7d415cb341fc87592e
3
+ metadata.gz: 8d5f260c0846fb882557b8a0126d4bc905f93af9
4
+ data.tar.gz: a76636beea09d3be97f32cf5f23d1df7b520985d
5
5
  SHA512:
6
- metadata.gz: 153746f190ba6ad0fb1a71e6310f230407f8fb82f48f66fa0e4ba0c1ad8555ec89025b34e46ecdc2992cb8dd91382723bb906a953898d61103c70a7ba8e9b654
7
- data.tar.gz: 4e9b895b4eb3a02f56d0d7efd5f2f8ab5c45dc139c2b05fea877bc55171fdd41edf28d758db886d22bf86ecdae6a528d243b91368538c4f30bbb97f6f0dbdec9
6
+ metadata.gz: a0303e52af1f2727f7c050e84dad78c0360308ada672d15a99ea8b839540af466a52b39173c44324903860762f51b7f54129d369a4619a7484e7e5168cf2ffe8
7
+ data.tar.gz: 5153762c66271ffd56cdfa0ce238f688d8c4c2949a619883573283a33e7e5ced5e2c6d75eb03dbc3052d2bd6c1005563af74aee06103974996f985069c8bf382
@@ -106,7 +106,9 @@ module VagrantPlugins
106
106
  @logger.info("Pruning DHCP configuration for #{network[:ip]}")
107
107
  prune_dhcpd_conf(network)
108
108
 
109
- if machine.config.control_dhcp == true
109
+ @env[:ui].error("CONTROL_DHCP is #{machine.config.control_dhcp.enable}")
110
+
111
+ if machine.config.control_dhcp.enable
110
112
  @env[:ui].info("Configuring DHCP for #{network[:ip]} on #{network[:vnet]}")
111
113
 
112
114
  write_dhcpd_conf(network)
@@ -24,6 +24,7 @@ module VagrantPlugins
24
24
  escaped_conf_location = Vagrant::Util::ShellQuote.escape(conf_location, "'")
25
25
 
26
26
  mac = network[:mac]
27
+ ip = network[:ip]
27
28
 
28
29
  before = File.open(conf_location).read
29
30
  @logger.debug("Before altering, dhcpd.conf content is #{before}")
@@ -40,6 +41,18 @@ module VagrantPlugins
40
41
 
41
42
  system(*command)
42
43
 
44
+ command = []
45
+ command << "sudo" if !File.writable?(conf_location)
46
+ command += [
47
+ "sed", "-E", "-e",
48
+ "/^# VAGRANT-BEGIN: #{ip}/," +
49
+ "/^# VAGRANT-END: #{ip}/ d",
50
+ "-ibak",
51
+ conf_location
52
+ ]
53
+
54
+ system(*command)
55
+
43
56
  after = File.open(conf_location).read
44
57
  @logger.debug("After, dhcpd.conf content is #{after}")
45
58
  end
@@ -24,6 +24,7 @@ module VagrantPlugins
24
24
  escaped_conf_location = Vagrant::Util::ShellQuote.escape(conf_location, "'")
25
25
 
26
26
  mac = network[:mac]
27
+ ip = network[:ip]
27
28
 
28
29
  before = File.open(conf_location).read
29
30
  @logger.debug("Before altering, dhcpd.conf content is #{before}")
@@ -40,6 +41,18 @@ module VagrantPlugins
40
41
 
41
42
  system(*command)
42
43
 
44
+ command = []
45
+ command << "sudo" if !File.writable?(conf_location)
46
+ command += [
47
+ "sed", "-E", "-e",
48
+ "/^# VAGRANT-BEGIN: #{ip}/," +
49
+ "/^# VAGRANT-END: #{ip}/ d",
50
+ "-ibak",
51
+ conf_location
52
+ ]
53
+
54
+ system(*command)
55
+
43
56
  after = File.open(conf_location).read
44
57
  @logger.debug("After, dhcpd.conf content is #{after}")
45
58
  end
@@ -27,11 +27,13 @@ module VagrantPlugins
27
27
  conf_location = dhcpd_conf_location(network)
28
28
 
29
29
  mac = network[:mac]
30
+ ip = network[:ip]
30
31
 
31
32
  before = File.open(conf_location).read
32
33
  @logger.debug("Before altering, dhcpd.conf content is #{before}")
33
34
 
34
- after = before.gsub(/^# VAGRANT-BEGIN: #{mac}.*^# VAGRANT-END: #{mac}\s+/m, '')
35
+ intermediate = before.gsub(/^# VAGRANT-BEGIN: #{mac}.*^# VAGRANT-END: #{mac}\s+/m, '')
36
+ after = intermediate.gsub(/^# VAGRANT-BEGIN: #{ip}.*^# VAGRANT-END: #{ip}\s+/m, '')
35
37
 
36
38
  File.open(conf_location, "w") { |fd| fd.write(after) }
37
39
 
@@ -11,7 +11,7 @@ module VagrantPlugins
11
11
 
12
12
  def finalize!
13
13
  if @enable != true
14
- @enable = false
14
+ @enable = false
15
15
  end
16
16
  end
17
17
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module VagrantVmwareDhcp
3
- VERSION = '0.0.7'
3
+ VERSION = '0.0.8'
4
4
  end
5
5
  end
@@ -1,4 +1,4 @@
1
- # VAGRANT-BEGIN: <%= mac %>
1
+ # VAGRANT-BEGIN: <%= ip %>
2
2
  host <%= name %> {
3
3
  hardware ethernet <%= mac %>;
4
4
  fixed-address <%= ip %>;
@@ -6,4 +6,4 @@ host <%= name %> {
6
6
  option domain-name "";
7
7
  option routers 0.0.0.0;
8
8
  }
9
- # VAGRANT-END: <%= mac %>
9
+ # VAGRANT-END: <%= ip %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-vmware-dhcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Israel Shirk