Skip to content

Commit

Permalink
Merge dc7d960 into c148fc1
Browse files Browse the repository at this point in the history
  • Loading branch information
dazuma committed Oct 12, 2017
2 parents c148fc1 + dc7d960 commit 5ddf166
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Metrics/MethodLength:
Max: 20
Metrics/ClassLength:
Enabled: false
Style/IndentHeredoc:
Layout/IndentHeredoc:
Enabled: false
Style/FormatString:
Enabled: false
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ group :development do
gem 'rake', '~> 10.0'
gem 'redis', '~> 3.2'
gem 'rspec', '~> 3.0'
gem 'rubocop', '>= 0.41', '< 0.50'
gem 'rubocop', '~> 0.50'
gem 'simplecov', '~> 0.9'
gem 'sinatra'
gem 'webmock', '~> 1.21'
Expand Down
4 changes: 2 additions & 2 deletions googleauth.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Gem::Specification.new do |s|
s.homepage = 'https://github.com/google/google-auth-library-ruby'
s.summary = 'Google Auth Library for Ruby'
s.license = 'Apache-2.0'
s.description = <<-eos
s.description = <<-DESCRIPTION
Allows simple authorization for accessing Google APIs.
Provide support for Application Default Credentials, as described at
https://developers.google.com/accounts/docs/application-default-credentials
eos
DESCRIPTION

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- spec/*`.split("\n")
Expand Down
8 changes: 4 additions & 4 deletions lib/googleauth/compute_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ module Google
# Module Auth provides classes that provide Google-specific authorization
# used to access Google APIs.
module Auth
NO_METADATA_SERVER_ERROR = <<END.freeze
NO_METADATA_SERVER_ERROR = <<ERROR_MESSAGE.freeze
Error code 404 trying to get security access token
from Compute Engine metadata for the default service account. This
may be because the virtual machine instance does not have permission
scopes specified.
END
UNEXPECTED_ERROR_SUFFIX = <<END.freeze
ERROR_MESSAGE
UNEXPECTED_ERROR_SUFFIX = <<ERROR_MESSAGE.freeze
trying to get security access token from Compute Engine metadata for
the default service account
END
ERROR_MESSAGE

# Extends Signet::OAuth2::Client so that the auth token is obtained from
# the GCE metadata server.
Expand Down
2 changes: 1 addition & 1 deletion lib/googleauth/credentials.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def self.from_json_vars(scope)
unless ENV[v].nil?
begin
JSON.parse ENV[v]
rescue
rescue StandardError
nil
end
end
Expand Down
8 changes: 3 additions & 5 deletions lib/googleauth/signet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,9 @@ def retry_with_error(max_retry_count = 5)

begin
yield
rescue => e
if e.is_a?(Signet::AuthorizationError) || e.is_a?(Signet::ParseError)
raise e
end

rescue Signet::AuthorizationError, Signet::ParseError
raise
rescue StandardError => e
if retry_count < max_retry_count
retry_count += 1
sleep retry_count * 0.3
Expand Down

0 comments on commit 5ddf166

Please sign in to comment.