lib/fog/openstack/volume.rb in fog-maestrodev-1.7.0.20121114190951 vs lib/fog/openstack/volume.rb in fog-maestrodev-1.8.0.20130109172219

- old
+ new

@@ -4,11 +4,11 @@ module Volume class OpenStack < Fog::Service requires :openstack_auth_url recognizes :openstack_auth_token, :openstack_management_url, :persistent, - :openstack_service_name, :openstack_tenant, + :openstack_service_type, :openstack_service_name, :openstack_tenant, :openstack_api_key, :openstack_username, :current_user, :current_tenant model_path 'fog/openstack/models/volume' @@ -109,11 +109,12 @@ @openstack_tenant = options[:openstack_tenant] @openstack_auth_uri = URI.parse(options[:openstack_auth_url]) @openstack_management_url = options[:openstack_management_url] @openstack_must_reauthenticate = false - @openstack_service_name = options[:openstack_service_name] || ['volume'] + @openstack_service_type = options[:openstack_service_type] || ['volume'] + @openstack_service_name = options[:openstack_service_name] @connection_options = options[:connection_options] || {} @current_user = options[:current_user] @current_tenant = options[:current_tenant] @@ -140,10 +141,11 @@ def request(params) begin response = @connection.request(params.merge({ :headers => { 'Content-Type' => 'application/json', + 'Accept' => 'application/json', 'X-Auth-Token' => @auth_token }.merge!(params[:headers] || {}), :host => @host, :path => "#{@path}/#{params[:path]}"#, # Causes errors for some requests like tenants?limit=1 @@ -172,16 +174,17 @@ end private def authenticate - if @openstack_must_reauthenticate || @openstack_auth_token.nil? + if !@openstack_management_url || @openstack_must_reauthenticate options = { :openstack_tenant => @openstack_tenant, :openstack_api_key => @openstack_api_key, :openstack_username => @openstack_username, :openstack_auth_uri => @openstack_auth_uri, :openstack_auth_token => @openstack_auth_token, + :openstack_service_type => @openstack_service_type, :openstack_service_name => @openstack_service_name, :openstack_endpoint_type => 'adminURL' } credentials = Fog::OpenStack.authenticate_v2(options, @connection_options)