fluent-plugin-redmine 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-redmine"
7
- spec.version = "0.3.0"
7
+ spec.version = "0.4.0"
8
8
  spec.authors = ["Takuma kanari"]
9
9
  spec.email = ["chemtrails.t@gmail.com"]
10
10
  spec.summary = %q{Output filter plugin to create ticket in redmine}
@@ -12,9 +12,11 @@ module Fluent
12
12
  config_param :api_key, :string, :default => nil
13
13
  config_param :tag_key, :string, :default => "tag"
14
14
  config_param :project_id, :string, :default => nil
15
- config_param :category_id, :string, :default => nil
15
+ config_param :category_id, :integer, :default => nil
16
+ config_param :category_id_key, :string, :default => nil
16
17
  config_param :tracker_id, :integer
17
18
  config_param :priority_id, :integer
19
+ config_param :priority_id_key, :string, :default => nil
18
20
  config_param :subject, :string, :default => "Fluent::RedmineOutput plugin"
19
21
  config_param :description, :string, :default => ""
20
22
  config_param :debug_http, :bool, :default => false
@@ -54,16 +56,11 @@ module Fluent
54
56
  end
55
57
 
56
58
  def emit(tag, es, chain)
57
- bulk = []
58
- es.each do |time,record|
59
- bulk << [
60
- @subject_expander.bind(make_record(tag, record)),
61
- @description_expander.bind(make_record(tag, record))
62
- ]
63
- end
64
- bulk.each do |subject, desc|
59
+ es.each do |time, record|
60
+ subject = @subject_expander.bind(make_record(tag, record))
61
+ desc = @description_expander.bind(make_record(tag, record))
65
62
  begin
66
- submit_ticket(subject, desc)
63
+ submit_ticket(subject, desc, record)
67
64
  rescue => e
68
65
  log.warn "out_redmine: failed to create ticket to #{@redmine_uri}, subject: #{subject}, description: #{desc}, error_class: #{e.class}, error_message: #{e.message}, error_backtrace: #{e.backtrace.first}"
69
66
  end
@@ -71,12 +68,12 @@ module Fluent
71
68
  chain.next
72
69
  end
73
70
 
74
- def submit_ticket(subject, desc)
71
+ def submit_ticket(subject, desc, record)
75
72
  request = Net::HTTP::Post.new(
76
73
  @redmine_uri.request_uri,
77
74
  initheader = @redmine_request_header
78
75
  )
79
- request.body = JSON.generate(make_payload(subject, desc))
76
+ request.body = JSON.generate(make_payload(subject, desc, record))
80
77
 
81
78
  client = Net::HTTP.new(@redmine_uri.host, @redmine_uri.port)
82
79
  if @use_ssl
@@ -96,13 +93,15 @@ module Fluent
96
93
  end
97
94
  end
98
95
 
99
- def make_payload(subject, desc)
96
+ def make_payload(subject, desc, record)
97
+ priority_id = @priority_id_key.nil? ? @priority_id : (record[@priority_id_key] || @priority_id).to_i
98
+ category_id = @category_id_key.nil? ? @category_id : (record[@category_id_key] || @category_id).to_i
100
99
  {
101
100
  :issue => {
102
101
  :project_id => @project_id,
103
102
  :tracker_id => @tracker_id,
104
- :priority_id => @priority_id,
105
- :category_id => @category_id,
103
+ :priority_id => priority_id,
104
+ :category_id => category_id,
106
105
  :subject => subject,
107
106
  :description => desc
108
107
  }
metadata CHANGED
@@ -1,41 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-redmine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Takuma kanari
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-04-26 00:00:00.000000000 Z
12
+ date: 2015-04-27 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rake
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - ">="
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - ">="
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0'
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: fluentd
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - ">="
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: '0'
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - ">="
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: '0'
41
46
  description: Output filter plugin to create ticket in redmine
@@ -45,7 +50,7 @@ executables: []
45
50
  extensions: []
46
51
  extra_rdoc_files: []
47
52
  files:
48
- - ".gitignore"
53
+ - .gitignore
49
54
  - Gemfile
50
55
  - LICENSE.txt
51
56
  - README.md
@@ -56,26 +61,27 @@ files:
56
61
  - test/plugin/test_out_redmine.rb
57
62
  homepage: https://github.com/takumakanari
58
63
  licenses: []
59
- metadata: {}
60
64
  post_install_message:
61
65
  rdoc_options: []
62
66
  require_paths:
63
67
  - lib
64
68
  required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
65
70
  requirements:
66
- - - ">="
71
+ - - ! '>='
67
72
  - !ruby/object:Gem::Version
68
73
  version: '0'
69
74
  required_rubygems_version: !ruby/object:Gem::Requirement
75
+ none: false
70
76
  requirements:
71
- - - ">="
77
+ - - ! '>='
72
78
  - !ruby/object:Gem::Version
73
79
  version: '0'
74
80
  requirements: []
75
81
  rubyforge_project: fluent-plugin-redmine
76
- rubygems_version: 2.2.2
82
+ rubygems_version: 1.8.23
77
83
  signing_key:
78
- specification_version: 4
84
+ specification_version: 3
79
85
  summary: Output filter plugin to create ticket in redmine
80
86
  test_files:
81
87
  - test/helper.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: e162c4ad546045b160bf45b8b36c66bec8472dbc
4
- data.tar.gz: 2d31a9eeb609510de013bc49577c6adc3033cb63
5
- SHA512:
6
- metadata.gz: 9cbf78875a9da7c2a70b4d646e4889c23a9942422a8c16f5d9478f033d6b27eab4d08e196b32233d84b9ae648f5055336645e3f94c5f4afa5e7574c8b64a56d4
7
- data.tar.gz: 95a12ef0ae71f96ef106a52a0f57aac38dcfd9891d14bb5721512fa6039d0d6ebbdfb6b1551e446e914c9109328e3865ed86c56da232d67cb92629f63fece023