Sha256: f964e21723f033154bde679e3001edaf5e9875de866ca22f11433f733d4be617

Contents?: true

Size: 812 Bytes

Versions: 2

Compression:

Stored size: 812 Bytes

Contents

module VagrantPlugins
  module Openstack
    class Utils
      def initialize
        @logger = Log4r::Logger.new('vagrant_openstack::action::config_resolver')
      end

      def get_ip_address(env)
        return env[:machine].provider_config.floating_ip unless env[:machine].provider_config.floating_ip.nil?
        details = env[:openstack_client].nova.get_server_details(env, env[:machine].id)
        details['addresses'].each do |network|
          network[1].each do |network_detail|
            return network_detail['addr'] if network_detail['OS-EXT-IPS:type'] == 'floating'
          end
        end
        return details['addresses'].first[1][0]['addr'] if details['addresses'].size >= 1 && details['addresses'].first[1].size >= 1
        fail Errors::UnableToResolveIP
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-openstack-provider-0.6.0 lib/vagrant-openstack-provider/utils.rb
vagrant-openstack-provider-0.5.2 lib/vagrant-openstack-provider/utils.rb