Module: Fog::OpenStack::Common
- Includes:
- Core
- Included in:
- Identity::OpenStack::V2::Real, Identity::OpenStack::V3::Real, Image::OpenStack::V1::Real, Image::OpenStack::V2::Real, Volume::OpenStack::V1::Real, Volume::OpenStack::V2::Real
- Defined in:
- lib/fog/openstack/common.rb
Instance Attribute Summary collapse
-
#unscoped_token ⇒ Object
readonly
Returns the value of attribute unscoped_token.
Attributes included from Core
#auth_token, #auth_token_expiration, #current_tenant, #current_user, #current_user_id, #openstack_domain_id, #openstack_domain_name, #openstack_identity_prefix, #openstack_project_domain, #openstack_project_domain_id, #openstack_user_domain, #openstack_user_domain_id
Instance Method Summary collapse
Methods included from Core
#credentials, #initialize_identity, #reload
Instance Attribute Details
#unscoped_token ⇒ Object (readonly)
Returns the value of attribute unscoped_token.
6 7 8 |
# File 'lib/fog/openstack/common.rb', line 6 def unscoped_token @unscoped_token end |
Instance Method Details
#request(params) ⇒ Object
10 11 12 13 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 40 41 42 43 |
# File 'lib/fog/openstack/common.rb', line 10 def request(params) retried = false begin std_headers = { 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'X-Auth-Token' => @auth_token } param_headers = params.fetch(:headers, {}) response = @connection.request(params.merge({ :headers => std_headers.merge(param_headers), :path => "#{@path}/#{params[:path]}" })) rescue Excon::Errors::Unauthorized => error raise if retried retried = true @openstack_must_reauthenticate = true authenticate retry rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound self.class.not_found_class.slurp(error) else error end end unless response.body.empty? response.body = Fog::JSON.decode(response.body) unless params[:raw_body] end response end |