Sha256: e2afcdeee812705dc3061a77259a730e7619b18af32318e279e0e326d63ec949
Contents?: true
Size: 1.05 KB
Versions: 4
Compression:
Stored size: 1.05 KB
Contents
module VagrantPlugins module ConoHa 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'] == 'fixed' && network_detail['version'] == 4 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
4 entries across 4 versions & 1 rubygems