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
Returns a new instance of ForwardPorts.
32 33 34 |
# File 'lib/vagrant-skytap/action/forward_ports.rb', line 32 def initialize(app, env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/vagrant-skytap/action/forward_ports.rb', line 36 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
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/vagrant-skytap/action/forward_ports.rb', line 50 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: "--", guest_port: fp.guest_port, host_port: fp.host_port)) @env[:host].capability(:start_ssh_tunnel, fp, @env[:machine]) end end end |