fluent-plugin-s3 0.5.2 → 0.5.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 94693d17ac1d8a9064b7ae64bac1496a74acf7de
4
- data.tar.gz: 300d4d8cb66c403a8237afcda3def9de6761c74a
3
+ metadata.gz: b4371b4a30965b7724f988a1c101f84af199dc09
4
+ data.tar.gz: b01e6df47133d2fc117d020e670b6ecfafef1b74
5
5
  SHA512:
6
- metadata.gz: de718a336390d3121a194afc54f7e5597fb6c0f8d250bb5096af21e3d8165b3dc5f7a6dd467cc25fcdab6107939cfb131f464f654d0297466ff4d2ee3a6dca0e
7
- data.tar.gz: 0379d7d50711f3f2ad4beec0774361f05f47da8b0aa0b7c364e69d0cd8475491d0764bd0f872cb7331c5edd2503926ff7d9f747959439c5544f36a42245e68c7
6
+ metadata.gz: 8abdf2a7ce8ea84e235355a9528eb09a39e01f0ddfbca63ad8d474b22f4003d7530ef9c94ab00342e3169a6afded6a4328dfa51b06a36370810eac72673481c8
7
+ data.tar.gz: 7f5ae08030d544e093ce716c35970bf2cb7cdbfebcf97947c9a214b95d1b458ace7fc449e5e52f44e7e86938d0f0baf4164aeb731d6b4f7b4153aeffbf497f62
data/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ Release 0.5.3 - 2015/02/06
2
+
3
+ * Add error information in API check
4
+ * Add GzipWriter fallback to gzip_command
5
+
6
+
1
7
  Release 0.5.2 - 2015/02/05
2
8
 
3
9
  * Add experimental gzip_command compressor
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.2
1
+ 0.5.3
@@ -44,13 +44,12 @@ module Fluent
44
44
  end
45
45
 
46
46
  begin
47
- @compressor = COMPRESSOR_REGISTRY.lookup(@store_as).new
47
+ @compressor = COMPRESSOR_REGISTRY.lookup(@store_as).new(:buffer_type => @buffer_type, :log => log)
48
48
  rescue => e
49
49
  $log.warn "#{@store_as} not found. Use 'text' instead"
50
50
  @compressor = TextCompressor.new
51
51
  end
52
52
  @compressor.configure(conf)
53
- @compressor.buffer_type = @buffer_type
54
53
 
55
54
  # TODO: use Plugin.new_formatter instead of TextFormatter.create
56
55
  conf['format'] = @format
@@ -139,19 +138,25 @@ module Fluent
139
138
  @bucket.empty?
140
139
  rescue AWS::S3::Errors::NoSuchBucket
141
140
  # ignore NoSuchBucket Error because ensure_bucket checks it.
142
- rescue
143
- raise "can't call S3 API. Please check your aws_key_id / aws_sec_key or s3_region configuration"
141
+ rescue => e
142
+ raise "can't call S3 API. Please check your aws_key_id / aws_sec_key or s3_region configuration. error = #{e.inspect}"
144
143
  end
145
144
 
146
145
  class Compressor
147
146
  include Configurable
148
147
 
148
+ def initialize(opts = {})
149
+ super()
150
+ @buffer_type = opts[:buffer_type]
151
+ @log = opts[:log]
152
+ end
153
+
154
+ attr_reader :buffer_type, :log
155
+
149
156
  def configure(conf)
150
157
  super
151
158
  end
152
159
 
153
- attr_accessor :buffer_type
154
-
155
160
  def ext
156
161
  end
157
162
 
@@ -190,7 +195,6 @@ module Fluent
190
195
  w.close
191
196
  ensure
192
197
  w.close rescue nil
193
- w.unlink rescue nil
194
198
  end
195
199
  end
196
200
 
@@ -26,15 +26,24 @@ module Fluent
26
26
  w = Tempfile.new("chunk-gzip-tmp")
27
27
  chunk.write_to(w)
28
28
  w.close
29
- tmp.close
30
29
  w.path
31
30
  end
32
- # We don't check the return code because we can't recover gzip failure.
33
- system "gzip #{@command_parameter} -c #{path} > #{tmp.path}"
31
+
32
+ res = system "gzip #{@command_parameter} -c #{path} > #{tmp.path}"
33
+ unless res
34
+ log.warn "failed to execute gzip command. Fallback to GzipWriter. status = #{$?}"
35
+ begin
36
+ tmp.truncate(0)
37
+ gw = Zlib::GzipWriter.new(tmp)
38
+ chunk.write_to(gw)
39
+ gw.close
40
+ ensure
41
+ gw.close rescue nil
42
+ end
43
+ end
34
44
  ensure
35
45
  unless chunk_is_file
36
- w.close rescue nil
37
- w.unlink rescue nil
46
+ w.close(true) rescue nil
38
47
  end
39
48
  end
40
49
  end
@@ -22,7 +22,7 @@ module Fluent
22
22
  w = Tempfile.new("chunk-xz-tmp")
23
23
  chunk.write_to(w)
24
24
  w.close
25
- tmp.close
25
+
26
26
  # We don't check the return code because we can't recover lzop failure.
27
27
  system "xz #{@command_parameter} -c #{w.path} > #{tmp.path}"
28
28
  ensure
@@ -22,7 +22,7 @@ module Fluent
22
22
  w = Tempfile.new("chunk-tmp")
23
23
  chunk.write_to(w)
24
24
  w.close
25
- tmp.close
25
+
26
26
  # We don't check the return code because we can't recover lzop failure.
27
27
  system "lzop #{@command_parameter} -o #{tmp.path} #{w.path}"
28
28
  ensure
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi