fluent-plugin-google-cloud 0.2.4 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ Gem::Specification.new do |gem|
4
4
  gem.summary = %q{Fluentd plugin to stream logs to the Google Cloud Platform's logging API}
5
5
  gem.homepage = 'https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud'
6
6
  gem.license = 'Apache 2.0'
7
- gem.version = '0.2.4'
7
+ gem.version = '0.3.0'
8
8
  gem.authors = ['Todd Derr', 'Alex Robinson']
9
9
  gem.email = ['salty@google.com']
10
10
 
@@ -36,10 +36,10 @@ module Fluent
36
36
  config_param :private_key_path, :string, :default => nil
37
37
  config_param :private_key_passphrase, :string, :default => 'notasecret'
38
38
 
39
- # If fetch_gce_metadata is set to true, we obtain the project_id, zone,
39
+ # If use_metadata_service is set to true, we obtain the project_id, zone,
40
40
  # and vm_id from the GCE metadata service. Otherwise, those parameters
41
41
  # must be specified in the config file explicitly.
42
- config_param :fetch_gce_metadata, :bool, :default => true
42
+ config_param :use_metadata_service, :bool, :default => true
43
43
  config_param :project_id, :string, :default => nil
44
44
  config_param :zone, :string, :default => nil
45
45
  config_param :vm_id, :string, :default => nil
@@ -86,10 +86,10 @@ module Fluent
86
86
  end
87
87
  end
88
88
 
89
- unless @fetch_gce_metadata
89
+ unless @use_metadata_service
90
90
  unless @project_id && @zone && @vm_id
91
91
  raise Fluent::ConfigError,
92
- ('Please specify "project_id", "zone" and "vm_id" if you set "fetch_gce_metadata" to false')
92
+ ('Please specify "project_id", "zone" and "vm_id" if you set "use_metadata_service" to false')
93
93
  end
94
94
  end
95
95
  end
@@ -101,7 +101,7 @@ module Fluent
101
101
 
102
102
  @successful_call = false
103
103
 
104
- if @fetch_gce_metadata
104
+ if @use_metadata_service
105
105
  # Grab metadata about the Google Compute Engine instance that we're on.
106
106
  @project_id = fetch_metadata('project/project-id')
107
107
  fully_qualified_zone = fetch_metadata('instance/zone')
@@ -114,7 +114,7 @@ module Fluent
114
114
  # If this is running on a Managed VM, grab the relevant App Engine
115
115
  # metadata as well.
116
116
  # TODO: Add config options for these to allow for running outside GCE?
117
- attributes_string = @fetch_gce_metadata ?
117
+ attributes_string = @use_metadata_service ?
118
118
  fetch_metadata('instance/attributes/') : ""
119
119
  attributes = attributes_string.split
120
120
  if (attributes.include?('gae_backend_name') &&
@@ -335,7 +335,7 @@ module Fluent
335
335
  def init_api_client
336
336
  @client = Google::APIClient.new(
337
337
  :application_name => 'Fluentd Google Cloud Logging plugin',
338
- :application_version => '0.2.4',
338
+ :application_version => '0.3.0',
339
339
  :retries => 1)
340
340
 
341
341
  if @auth_method == 'private_key'
@@ -51,7 +51,7 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
51
51
  ]
52
52
 
53
53
  CUSTOM_METADATA_CONFIG = %[
54
- fetch_gce_metadata false
54
+ use_metadata_service false
55
55
  project_id #{CUSTOM_PROJECT_ID}
56
56
  zone #{CUSTOM_ZONE}
57
57
  vm_id #{CUSTOM_VM_ID}
@@ -66,7 +66,7 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
66
66
  private_key_path /fake/path/to/key
67
67
  ]
68
68
  INVALID_CONFIG_MISSING_METADATA_VM_ID = %[
69
- fetch_gce_metadata false
69
+ use_metadata_service false
70
70
  project_id #{CUSTOM_PROJECT_ID}
71
71
  zone #{CUSTOM_ZONE}
72
72
  ]
@@ -156,7 +156,7 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
156
156
  begin
157
157
  d = create_driver(INVALID_CONFIG_MISSING_METADATA_VM_ID)
158
158
  rescue Fluent::ConfigError => error
159
- assert error.message.include? 'fetch_gce_metadata'
159
+ assert error.message.include? 'use_metadata_service'
160
160
  exception_count += 1
161
161
  end
162
162
  assert_equal 1, exception_count
@@ -185,7 +185,7 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
185
185
  assert_equal MANAGED_VM_BACKEND_VERSION, d.instance.gae_backend_version
186
186
  end
187
187
 
188
- def test_gce_metadata_does_not_load_when_fetch_gce_metadata_is_false
188
+ def test_gce_metadata_does_not_load_when_use_metadata_service_is_false
189
189
  Fluent::GoogleCloudOutput.any_instance.expects(:fetch_metadata).never
190
190
  d = create_driver(CUSTOM_METADATA_CONFIG)
191
191
  d.run
@@ -554,6 +554,14 @@ class GoogleCloudOutputTest < Test::Unit::TestCase
554
554
  :status => 200,
555
555
  :headers => {'Content-Length' => FAKE_AUTH_TOKEN.length,
556
556
  'Content-Type' => 'application/json' })
557
+
558
+ stub_request(:post, 'https://www.googleapis.com/oauth2/v3/token').
559
+ with(:body => hash_including({:grant_type => 'refresh_token'})).
560
+ to_return(:body => "{\"access_token\": \"#{FAKE_AUTH_TOKEN}\"}",
561
+ :status => 200,
562
+ :headers => {'Content-Length' => FAKE_AUTH_TOKEN.length,
563
+ 'Content-Type' => 'application/json' })
564
+
557
565
  # Used for 'private_key' auth.
558
566
  stub_request(:post, 'https://accounts.google.com/o/oauth2/token').
559
567
  with(:body => hash_including({:grant_type => AUTH_GRANT_TYPE})).
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-google-cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-05-06 00:00:00.000000000 Z
13
+ date: 2015-05-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: fluentd
@@ -144,7 +144,6 @@ files:
144
144
  - fluent-plugin-google-cloud.gemspec
145
145
  - lib/fluent/plugin/out_google_cloud.rb
146
146
  - CONTRIBUTING
147
- - Gemfile.lock
148
147
  - Gemfile
149
148
  - README.rdoc
150
149
  homepage: https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud
data/Gemfile.lock DELETED
@@ -1,107 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- fluent-plugin-google-cloud (0.2.4)
5
- fluentd (>= 0.10)
6
- google-api-client (>= 0.8)
7
- googleauth (~> 0.4)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- activesupport (4.2.1)
13
- i18n (~> 0.7)
14
- json (~> 1.7, >= 1.7.7)
15
- minitest (~> 5.1)
16
- thread_safe (~> 0.3, >= 0.3.4)
17
- tzinfo (~> 1.1)
18
- addressable (2.3.8)
19
- autoparse (0.3.3)
20
- addressable (>= 2.3.1)
21
- extlib (>= 0.9.15)
22
- multi_json (>= 1.0.0)
23
- cool.io (1.3.0)
24
- crack (0.4.2)
25
- safe_yaml (~> 1.0.0)
26
- extlib (0.9.16)
27
- faraday (0.9.1)
28
- multipart-post (>= 1.2, < 3)
29
- fluentd (0.12.8)
30
- cool.io (>= 1.2.2, < 2.0.0)
31
- http_parser.rb (>= 0.5.1, < 0.7.0)
32
- json (>= 1.4.3)
33
- msgpack (>= 0.5.11, < 0.6.0)
34
- sigdump (~> 0.2.2)
35
- string-scrub (>= 0.0.3)
36
- tzinfo (>= 1.0.0)
37
- tzinfo-data (>= 1.0.0)
38
- yajl-ruby (~> 1.0)
39
- google-api-client (0.8.6)
40
- activesupport (>= 3.2)
41
- addressable (~> 2.3)
42
- autoparse (~> 0.3)
43
- extlib (~> 0.9)
44
- faraday (~> 0.9)
45
- googleauth (~> 0.3)
46
- launchy (~> 2.4)
47
- multi_json (~> 1.10)
48
- retriable (~> 1.4)
49
- signet (~> 0.6)
50
- googleauth (0.4.1)
51
- faraday (~> 0.9)
52
- jwt (~> 1.4)
53
- logging (~> 2.0)
54
- memoist (~> 0.12)
55
- multi_json (= 1.11)
56
- signet (~> 0.6)
57
- http_parser.rb (0.6.0)
58
- i18n (0.7.0)
59
- json (1.8.2)
60
- jwt (1.4.1)
61
- launchy (2.4.3)
62
- addressable (~> 2.3)
63
- little-plugger (1.1.3)
64
- logging (2.0.0)
65
- little-plugger (~> 1.1)
66
- multi_json (~> 1.10)
67
- memoist (0.12.0)
68
- metaclass (0.0.4)
69
- minitest (5.6.1)
70
- mocha (1.1.0)
71
- metaclass (~> 0.0.1)
72
- msgpack (0.5.11)
73
- multi_json (1.11.0)
74
- multipart-post (2.0.0)
75
- power_assert (0.2.3)
76
- rake (10.4.2)
77
- retriable (1.4.1)
78
- safe_yaml (1.0.4)
79
- sigdump (0.2.2)
80
- signet (0.6.0)
81
- addressable (~> 2.3)
82
- extlib (~> 0.9)
83
- faraday (~> 0.9)
84
- jwt (~> 1.0)
85
- multi_json (~> 1.10)
86
- string-scrub (0.0.5)
87
- test-unit (3.0.9)
88
- power_assert
89
- thread_safe (0.3.5)
90
- tzinfo (1.2.2)
91
- thread_safe (~> 0.1)
92
- tzinfo-data (1.2015.4)
93
- tzinfo (>= 1.0.0)
94
- webmock (1.21.0)
95
- addressable (>= 2.3.6)
96
- crack (>= 0.3.2)
97
- yajl-ruby (1.2.1)
98
-
99
- PLATFORMS
100
- ruby
101
-
102
- DEPENDENCIES
103
- fluent-plugin-google-cloud!
104
- mocha (~> 1.1)
105
- rake (>= 10.3.2)
106
- test-unit (~> 3.0.2)
107
- webmock (>= 1.17.0)