15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/vagrant/action/vm/sane_defaults.rb', line 15
def call(env)
@env = env
command = [
"storagectl", env[:vm].uuid,
"--name", "SATA Controller",
"--hostiocache", "on"
]
attempt_and_log(command, "Enabling the Host I/O cache on the SATA controller...")
enable_dns_proxy = true
begin
contents = File.read("/etc/resolv.conf")
if contents =~ /^nameserver 127\.0\.(0|1)\.1$/
@logger.info("Disabling DNS proxy since resolv.conf contains 127.0.0.1")
enable_dns_proxy = false
end
rescue Errno::ENOENT; end
if enable_dns_proxy
command = [
"modifyvm", env[:vm].uuid,
"--natdnsproxy1", "on"
]
attempt_and_log(command, "Enable the NAT DNS proxy on adapter 1...")
else
command = [ "modifyvm", env[:vm].uuid, "--natdnsproxy1", "off" ]
attempt_and_log(command, "Disable the NAT DNS proxy on adapter 1...")
command = [ "modifyvm", env[:vm].uuid, "--natdnshostresolver1", "off" ]
attempt_and_log(command, "Disable the NAT DNS resolver on adapter 1...")
end
@app.call(env)
end
|