From 00d12538509d512ca55ac8c461c0ceed1be77fb0 Mon Sep 17 00:00:00 2001 From: Anton Ouzounov Date: Wed, 10 Nov 2021 14:28:45 -0500 Subject: [PATCH] chore(gemspec): update fluentd >= 1.14.x - update fluentd to 1.14.x gem - update json gem to 2.5.1 - fix deprecation warnings during rake tests: `common.rb:114: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open` Fluentd changelog for [v1.14.x](https://github.com/fluent/fluentd/blob/master/CHANGELOG.md#v1140) Signed-off-by: Anton Ouzounov --- fluent-plugin-google-cloud.gemspec | 8 ++++---- lib/fluent/plugin/common.rb | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/fluent-plugin-google-cloud.gemspec b/fluent-plugin-google-cloud.gemspec index 83556746..f05aa5db 100644 --- a/fluent-plugin-google-cloud.gemspec +++ b/fluent-plugin-google-cloud.gemspec @@ -10,7 +10,7 @@ eos gem.homepage = 'https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud' gem.license = 'Apache-2.0' - gem.version = '0.12.3' + gem.version = '0.13.0' gem.authors = ['Stackdriver Agents Team'] gem.email = ['stackdriver-agents@google.com'] gem.required_ruby_version = Gem::Requirement.new('>= 2.2') @@ -22,14 +22,14 @@ eos # Note: In order to update the Fluentd version, please update both here and # also the fluentd version in # https://github.com/GoogleCloudPlatform/google-fluentd/blob/master/config/software/fluentd.rb. - gem.add_runtime_dependency 'fluentd', '1.13.3' + gem.add_runtime_dependency 'fluentd', '~> 1.14.0' gem.add_runtime_dependency 'googleapis-common-protos', '1.3.10' gem.add_runtime_dependency 'googleauth', '0.9.0' gem.add_runtime_dependency 'google-api-client', '0.30.8' - gem.add_runtime_dependency 'google-cloud-logging', '1.6.6' + gem.add_runtime_dependency 'google-cloud-logging', '1.7.0' gem.add_runtime_dependency 'google-protobuf', '3.17.3' gem.add_runtime_dependency 'grpc', '1.31.1' - gem.add_runtime_dependency 'json', '2.4.1' + gem.add_runtime_dependency 'json', '2.5.1' gem.add_runtime_dependency 'opencensus', '0.5.0' gem.add_runtime_dependency 'opencensus-stackdriver', '0.4.1' diff --git a/lib/fluent/plugin/common.rb b/lib/fluent/plugin/common.rb index 8d16c2a7..8d6f90ba 100644 --- a/lib/fluent/plugin/common.rb +++ b/lib/fluent/plugin/common.rb @@ -111,7 +111,7 @@ def detect_platform(use_metadata_service) end begin - open('http://' + METADATA_SERVICE_ADDR, proxy: false) do |f| + URI.open('http://' + METADATA_SERVICE_ADDR, proxy: false) do |f| if f.meta['metadata-flavor'] == 'Google' @log.info 'Detected GCE platform' return Platform::GCE @@ -133,9 +133,8 @@ def fetch_gce_metadata(platform, metadata_path) raise "Called fetch_gce_metadata with platform=#{platform}" unless platform == Platform::GCE # See https://cloud.google.com/compute/docs/metadata - open('http://' + METADATA_SERVICE_ADDR + '/computeMetadata/v1/' + - metadata_path, 'Metadata-Flavor' => 'Google', :proxy => false, - &:read) + URI.open('http://' + METADATA_SERVICE_ADDR + '/computeMetadata/v1/' + + metadata_path, 'Metadata-Flavor' => 'Google', :proxy => false, &:read) end # EC2 Metadata server returns everything in one call. Store it after the @@ -145,7 +144,7 @@ def ec2_metadata(platform) platform == Platform::EC2 unless @ec2_metadata # See http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html - open('http://' + METADATA_SERVICE_ADDR + + URI.open('http://' + METADATA_SERVICE_ADDR + '/latest/dynamic/instance-identity/document', proxy: false) do |f| contents = f.read @ec2_metadata = JSON.parse(contents)