Class: VagrantPlugins::Skytap::Action::ForwardPorts
- Includes:
- Util::CompileForwardedPorts
- Defined in:
- lib/vagrant-skytap/action/forward_ports.rb
Overview
This is based on code from the VirtualBox provider.
Instance Method Summary collapse
- #call(env) ⇒ Object
- #forward_ports ⇒ Object
-
#initialize(app, env) ⇒ ForwardPorts
constructor
A new instance of ForwardPorts.
Methods included from Util::CompileForwardedPorts
Constructor Details
#initialize(app, env) ⇒ ForwardPorts
10 11 12 |
# File 'lib/vagrant-skytap/action/forward_ports.rb', line 10 def initialize(app, env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/vagrant-skytap/action/forward_ports.rb', line 14 def call(env) @env = env env[:forwarded_ports] ||= compile_forwarded_ports(env[:machine].config) if env[:forwarded_ports].any?(&:privileged_host_port?) env[:ui].warn I18n.t("vagrant.actions.vm.forward_ports.privileged_ports") end env[:ui].output(I18n.t("vagrant.actions.vm.forward_ports.forwarding")) forward_ports @app.call(env) end |
#forward_ports ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/vagrant-skytap/action/forward_ports.rb', line 28 def forward_ports @env[:forwarded_ports].each do |fp| unless fp.internal_ssh_port? @env[:ui].detail(I18n.t("vagrant.actions.vm.forward_ports.forwarding_entry", adapter: fp.adapter, guest_port: fp.guest_port, host_port: fp.host_port)) @env[:host].capability(:start_ssh_tunnel, fp, @env[:machine]) end end end |