25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/fog/openstack/core.rb', line 25
def initialize_identity(options)
options.select { |x| x.to_s.start_with? 'openstack' }.each do |openstack_param, value|
instance_variable_set "@#{openstack_param}".to_sym, value
end
@auth_token ||= options[:openstack_auth_token]
@openstack_identity_public_endpoint = options[:openstack_identity_endpoint]
@openstack_auth_uri = URI.parse(options[:openstack_auth_url])
@openstack_must_reauthenticate = false
@openstack_endpoint_type = options[:openstack_endpoint_type] || 'publicURL'
@openstack_cache_ttl = options[:openstack_cache_ttl] || 0
if @auth_token
@openstack_can_reauthenticate = false
else
missing_credentials = []
missing_credentials << :openstack_api_key unless @openstack_api_key
unless @openstack_username || @openstack_userid
missing_credentials << 'openstack_username or openstack_userid'
end
raise ArgumentError, "Missing required arguments: #{missing_credentials.join(', ')}" unless missing_credentials.empty?
@openstack_can_reauthenticate = true
end
@current_user = options[:current_user]
@current_user_id = options[:current_user_id]
@current_tenant = options[:current_tenant]
end
|