Module: Torpedo::Metering::Helper

Defined in:
lib/torpedo/metering/helper.rb

Class Method Summary collapse

Class Method Details

.get_connectionObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/torpedo/metering/helper.rb', line 14

def self.get_connection

  if ENV['DEBUG'] and ENV['DEBUG'] == 'true' then
    ENV['EXCON_DEBUG'] = 'true'
  end

  auth_url = ENV['OS_AUTH_URL']
  api_key = ENV['OS_PASSWORD']
  username = ENV['OS_USERNAME']
  authtenant = ENV['OS_TENANT_NAME']
  #region = ENV['OS_AUTH_REGION']
  service_type = ENV['CEILOMETER_SERVICE_TYPE'] || "metering"
  service_name = ENV['CEILOMETER_SERVICE_NAME'] #nil by default

  Fog::Metering.new(
    :provider           => :openstack,
    :openstack_auth_url  => auth_url+'/tokens',
    :openstack_username => username,
    :openstack_tenant => authtenant,
    :openstack_api_key => api_key,
    #:openstack_region => region,
    :openstack_service_type => service_type,
    :openstack_service_name => service_name
  )

end