Check for redir before booting the machine
This commit is contained in:
parent
a2a9cb99d1
commit
041f185395
1 changed files with 9 additions and 10 deletions
|
@ -10,12 +10,13 @@ module Vagrant
|
||||||
def call(env)
|
def call(env)
|
||||||
@env = env
|
@env = env
|
||||||
|
|
||||||
# Continue, we need the VM to be booted in order to grab its IP
|
|
||||||
@app.call env
|
|
||||||
|
|
||||||
# Get the ports we're forwarding
|
# Get the ports we're forwarding
|
||||||
env[:forwarded_ports] = compile_forwarded_ports(env[:machine].config)
|
env[:forwarded_ports] = compile_forwarded_ports(env[:machine].config)
|
||||||
|
|
||||||
|
if @env[:forwarded_ports].any? and not redir_installed?
|
||||||
|
raise Errors::RedirNotInstalled
|
||||||
|
end
|
||||||
|
|
||||||
# Warn if we're port forwarding to any privileged ports
|
# Warn if we're port forwarding to any privileged ports
|
||||||
env[:forwarded_ports].each do |fp|
|
env[:forwarded_ports].each do |fp|
|
||||||
if fp[:host] <= 1024
|
if fp[:host] <= 1024
|
||||||
|
@ -24,14 +25,12 @@ module Vagrant
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Continue, we need the VM to be booted in order to grab its IP
|
||||||
|
@app.call env
|
||||||
|
|
||||||
if @env[:forwarded_ports].any?
|
if @env[:forwarded_ports].any?
|
||||||
env[:ui].info I18n.t("vagrant.actions.vm.forward_ports.forwarding")
|
env[:ui].info I18n.t("vagrant.actions.vm.forward_ports.forwarding")
|
||||||
|
forward_ports
|
||||||
if redir_installed?
|
|
||||||
forward_ports
|
|
||||||
else
|
|
||||||
raise Errors::RedirNotInstalled
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -86,7 +85,7 @@ module Vagrant
|
||||||
end
|
end
|
||||||
|
|
||||||
def redir_installed?
|
def redir_installed?
|
||||||
system "sudo which redir"
|
system "sudo which redir > /dev/null"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue