Class: Vagrant::Smartos::Zones::Action::ForwardGZPorts
- Inherits:
-
Object
- Object
- Vagrant::Smartos::Zones::Action::ForwardGZPorts
- Includes:
- Helper, VagrantPlugins::ProviderVirtualBox::Util::CompileForwardedPorts
- Defined in:
- lib/vagrant/smartos/zones/action/forward_gz_ports.rb
Instance Attribute Summary
Attributes included from Helper
Instance Method Summary collapse
-
#call(env) ⇒ Object
This middleware sets up a VirtualBox port forward to 2222 in the global zone.
- #configure_gz_port_forward ⇒ Object
-
#initialize(app, env) ⇒ ForwardGZPorts
constructor
A new instance of ForwardGZPorts.
- #network ⇒ Object
- #port_forward_options ⇒ Object
Constructor Details
#initialize(app, env) ⇒ ForwardGZPorts
Returns a new instance of ForwardGZPorts.
11 12 13 14 |
# File 'lib/vagrant/smartos/zones/action/forward_gz_ports.rb', line 11 def initialize(app, env) @app = app @env = env end |
Instance Method Details
#call(env) ⇒ Object
This middleware sets up a VirtualBox port forward to 2222 in the global zone. ipnat in the global zone is configured to route this to 22 in the global zone, even when all other ports are forwarded to a zone.
19 20 21 22 23 |
# File 'lib/vagrant/smartos/zones/action/forward_gz_ports.rb', line 19 def call(env) configure_gz_port_forward if zone_configured? app.call(env) end |
#configure_gz_port_forward ⇒ Object
25 26 27 28 |
# File 'lib/vagrant/smartos/zones/action/forward_gz_ports.rb', line 25 def configure_gz_port_forward machine.ui.info 'Configuring a port forward to talk to the Global Zone' machine.config.vm.network :forwarded_port, end |
#network ⇒ Object
30 31 32 |
# File 'lib/vagrant/smartos/zones/action/forward_gz_ports.rb', line 30 def network machine.config.vm.networks.first end |
#port_forward_options ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/vagrant/smartos/zones/action/forward_gz_ports.rb', line 34 def scoped_hash_override(network[1], :virtualbox).merge( id: 'gz_ssh', guest: machine.config.global_zone.ssh_port, host: machine.config.global_zone.forwarded_ssh_port, auto_correct: true ) end |