Sha256: f4b018970a611c9c5f201aa572f27ad0071a88ce92e7273eaf53c9a812250827
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
module VagrantPlugins module Openstack class Utils def initialize @logger = Log4r::Logger.new('vagrant_openstack::action::config_resolver') end def get_ip_address(env) addresses = env[:openstack_client].nova.get_server_details(env, env[:machine].id)['addresses'] addresses.each do |_, network| network.each do |network_detail| return network_detail['addr'] if network_detail['OS-EXT-IPS:type'] == 'floating' end # Do not choose IPv6 address network.delete_if do |network_detail| network_detail['version'] == 6 end end fail Errors::UnableToResolveIP if addresses.size == 0 if addresses.size == 1 net_addresses = addresses.first[1] else first_network = env[:machine].provider_config.networks[0] if first_network.is_a? String net_addresses = addresses[first_network] else net_addresses = addresses[first_network[:name]] end end fail Errors::UnableToResolveIP if net_addresses.size == 0 net_addresses[0]['addr'] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vagrant-openstack-provider-illuin-0.11.1 | lib/vagrant-openstack-provider/utils.rb |