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 +4 -4
- data/lib/vagrant-vmware-dhcp/action/config_dhcp.rb +3 -1
- data/lib/vagrant-vmware-dhcp/action/config_dhcp_darwin.rb +13 -0
- data/lib/vagrant-vmware-dhcp/action/config_dhcp_linux.rb +13 -0
- data/lib/vagrant-vmware-dhcp/action/config_dhcp_windows.rb +3 -1
- data/lib/vagrant-vmware-dhcp/config.rb +1 -1
- data/lib/vagrant-vmware-dhcp/version.rb +1 -1
- data/templates/dhcpd_static.erb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d5f260c0846fb882557b8a0126d4bc905f93af9
|
4
|
+
data.tar.gz: a76636beea09d3be97f32cf5f23d1df7b520985d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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
|
|
data/templates/dhcpd_static.erb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# VAGRANT-BEGIN: <%=
|
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: <%=
|
9
|
+
# VAGRANT-END: <%= ip %>
|