Sha256: e79d3c2d09d361c5ac729ee32e6fa33bd91962d8ecb66213f046e29a7b502ba7
Contents?: true
Size: 1.2 KB
Versions: 2
Compression:
Stored size: 1.2 KB
Contents
module VagrantPlugins module VCloud module Cap module ForwardedPorts # Reads the forwarded ports that currently exist on the machine # itself. This raises an exception if the machine isn't running. # # This also may not match up with configured forwarded ports, because # Vagrant auto port collision fixing may have taken place. # # @return [Hash<Integer, Integer>] Host => Guest port mappings. def self.forwarded_ports(machine) result = {} cfg = machine.provider_config cnx = cfg.vcloud_cnx.driver vapp_id = machine.get_vapp_id vm_name = machine.name vm = cnx.get_vapp(vapp_id) myhash = vm[:vms_hash][vm_name.to_sym] if vm.nil? return end if cfg.network_bridge.nil? rules = cnx.get_vapp_port_forwarding_rules(vapp_id) rules.each do |rule| if rule[:vapp_scoped_local_id] == myhash[:vapp_scoped_local_id] result[rule[:nat_external_port].to_i] = rule[:nat_internal_port].to_i end end end result end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vagrant-vcloud-0.3.3 | lib/vagrant-vcloud/cap/forwarded_ports.rb |
vagrant-vcloud-0.3.2 | lib/vagrant-vcloud/cap/forwarded_ports.rb |