fluent-plugin-redmine 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +7 -4
- data/fluent-plugin-redmine.gemspec +1 -1
- data/lib/fluent/plugin/out_redmine.rb +9 -5
- data/test/plugin/test_out_redmine.rb +50 -1
- metadata +12 -18
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2f77ef53478fee9950fbedc082a10353074adaad
|
4
|
+
data.tar.gz: 6784a5a16fe6e4b162685d9a7818092e4df1b341
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: aefae1cb9d67bf18217fb403a39c707d155fd6b2ef97ab080ed99f9668c8377421129cf0cc1bc77800341de5e1fefbf0d90f798a20a0263573e0493f84c2d47a
|
7
|
+
data.tar.gz: c202eb134d98db49bcff5b54f2870931ca1ec3bfea446193fa107e7464762db646cbaeddf36c3e0fcd599dc37fb6ddb79da359b7c75d76d1fba8169d877bb8a3
|
data/README.md
CHANGED
@@ -36,10 +36,13 @@ Here is example settings:
|
|
36
36
|
|
37
37
|
and here is optional configuration:
|
38
38
|
|
39
|
-
project_id myproject
|
40
|
-
category_id 70
|
41
|
-
|
42
|
-
|
39
|
+
project_id myproject # projectId of redmine
|
40
|
+
category_id 70 # categoryId of tickets
|
41
|
+
project_id_key key_of_priority_id # value in record for priorityId
|
42
|
+
category_id_key key_of_category_id # value in record for categoryId
|
43
|
+
tag_key my_ tag # 'tag' is used by default
|
44
|
+
debug_http true # set debug_http=true of Net::HTTP module, false is used by default
|
45
|
+
|
43
46
|
|
44
47
|
### placeholders
|
45
48
|
|
@@ -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.
|
7
|
+
spec.version = "0.5.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}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Fluent
|
2
2
|
|
3
|
-
class RedmineOutput <
|
3
|
+
class RedmineOutput < BufferedOutput
|
4
4
|
Fluent::Plugin.register_output('redmine', self)
|
5
5
|
|
6
6
|
# Define `log` method for v0.10.42 or earlier
|
@@ -55,17 +55,21 @@ module Fluent
|
|
55
55
|
}
|
56
56
|
end
|
57
57
|
|
58
|
-
def
|
59
|
-
|
58
|
+
def format(tag, time, record)
|
59
|
+
[tag, time, record].to_msgpack
|
60
|
+
end
|
61
|
+
|
62
|
+
def write(chunk)
|
63
|
+
chunk.msgpack_each do |tag, time, record|
|
60
64
|
subject = @subject_expander.bind(make_record(tag, record))
|
61
65
|
desc = @description_expander.bind(make_record(tag, record))
|
62
66
|
begin
|
63
67
|
submit_ticket(subject, desc, record)
|
64
68
|
rescue => e
|
65
|
-
log.
|
69
|
+
log.error "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}"
|
70
|
+
raise e
|
66
71
|
end
|
67
72
|
end
|
68
|
-
chain.next
|
69
73
|
end
|
70
74
|
|
71
75
|
def submit_ticket(subject, desc, record)
|
@@ -16,6 +16,22 @@ class RedmineOutputTest < Test::Unit::TestCase
|
|
16
16
|
project_id 1
|
17
17
|
tracker_id 2
|
18
18
|
priority_id 3
|
19
|
+
category_id 4
|
20
|
+
subject awesome
|
21
|
+
description this is description %{d1} - %{d2} - %{d3}
|
22
|
+
]
|
23
|
+
|
24
|
+
CONFIG_WITH_PROPERTY_ALIAS_KEYS = %[
|
25
|
+
type redmine
|
26
|
+
url http://localhost:4000
|
27
|
+
api_key test-api-key
|
28
|
+
tag_key test
|
29
|
+
project_id 1
|
30
|
+
tracker_id 2
|
31
|
+
priority_id 3
|
32
|
+
category_id 4
|
33
|
+
priority_id_key key_of_priority_id
|
34
|
+
category_id_key key_of_category_id
|
19
35
|
subject awesome
|
20
36
|
description this is description %{d1} - %{d2} - %{d3}
|
21
37
|
]
|
@@ -121,8 +137,18 @@ class RedmineOutputTest < Test::Unit::TestCase
|
|
121
137
|
assert_equal "1", p.project_id
|
122
138
|
assert_equal 2, p.tracker_id
|
123
139
|
assert_equal 3, p.priority_id
|
140
|
+
assert_equal 4, p.category_id
|
124
141
|
assert_equal "awesome", p.subject
|
125
142
|
assert_equal "this is description %{d1} - %{d2} - %{d3}", p.description
|
143
|
+
assert_nil p.priority_id_key
|
144
|
+
assert_nil p.category_id_key
|
145
|
+
end
|
146
|
+
|
147
|
+
def test_configure_property_alias_keys
|
148
|
+
p = nil
|
149
|
+
assert_nothing_raised { p = create_driver(CONFIG_WITH_PROPERTY_ALIAS_KEYS).instance }
|
150
|
+
assert_equal "key_of_priority_id", p.priority_id_key
|
151
|
+
assert_equal "key_of_category_id", p.category_id_key
|
126
152
|
end
|
127
153
|
|
128
154
|
def test_configure_https
|
@@ -163,7 +189,12 @@ CONFIG
|
|
163
189
|
|
164
190
|
def test_make_payload
|
165
191
|
p = create_driver(CONFIG_DEFAULT).instance
|
166
|
-
|
192
|
+
record = {
|
193
|
+
"name" => "John",
|
194
|
+
"age" => 25,
|
195
|
+
"message" => "this is message!"
|
196
|
+
}
|
197
|
+
ret = p.make_payload("subject", "description", record)
|
167
198
|
assert_equal "subject", ret[:issue][:subject]
|
168
199
|
assert_equal "description", ret[:issue][:description]
|
169
200
|
assert_equal p.project_id, ret[:issue][:project_id]
|
@@ -171,6 +202,24 @@ CONFIG
|
|
171
202
|
assert_equal p.priority_id, ret[:issue][:priority_id]
|
172
203
|
end
|
173
204
|
|
205
|
+
def test_make_payload_with_alias_keys
|
206
|
+
p = create_driver(CONFIG_WITH_PROPERTY_ALIAS_KEYS).instance
|
207
|
+
record = {
|
208
|
+
"key_of_priority_id" => "123",
|
209
|
+
"key_of_category_id" => "456"
|
210
|
+
}
|
211
|
+
ret = p.make_payload("subject", "description", record)
|
212
|
+
assert_equal 123, ret[:issue][:priority_id]
|
213
|
+
assert_equal 456, ret[:issue][:category_id]
|
214
|
+
end
|
215
|
+
|
216
|
+
def test_make_payload_with_alias_keys_use_default_ids
|
217
|
+
p = create_driver(CONFIG_WITH_PROPERTY_ALIAS_KEYS).instance
|
218
|
+
ret = p.make_payload("subject", "description", {})
|
219
|
+
assert_equal 3, ret[:issue][:priority_id]
|
220
|
+
assert_equal 4, ret[:issue][:category_id]
|
221
|
+
end
|
222
|
+
|
174
223
|
def test_emit
|
175
224
|
d = create_driver(CONFIG_TO_FORMAT)
|
176
225
|
record = {
|
metadata
CHANGED
@@ -1,46 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-redmine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Takuma kanari
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2015-
|
11
|
+
date: 2015-05-19 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: fluentd
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
description: Output filter plugin to create ticket in redmine
|
@@ -50,7 +45,7 @@ executables: []
|
|
50
45
|
extensions: []
|
51
46
|
extra_rdoc_files: []
|
52
47
|
files:
|
53
|
-
- .gitignore
|
48
|
+
- ".gitignore"
|
54
49
|
- Gemfile
|
55
50
|
- LICENSE.txt
|
56
51
|
- README.md
|
@@ -61,27 +56,26 @@ files:
|
|
61
56
|
- test/plugin/test_out_redmine.rb
|
62
57
|
homepage: https://github.com/takumakanari
|
63
58
|
licenses: []
|
59
|
+
metadata: {}
|
64
60
|
post_install_message:
|
65
61
|
rdoc_options: []
|
66
62
|
require_paths:
|
67
63
|
- lib
|
68
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
65
|
requirements:
|
71
|
-
- -
|
66
|
+
- - ">="
|
72
67
|
- !ruby/object:Gem::Version
|
73
68
|
version: '0'
|
74
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
70
|
requirements:
|
77
|
-
- -
|
71
|
+
- - ">="
|
78
72
|
- !ruby/object:Gem::Version
|
79
73
|
version: '0'
|
80
74
|
requirements: []
|
81
75
|
rubyforge_project: fluent-plugin-redmine
|
82
|
-
rubygems_version:
|
76
|
+
rubygems_version: 2.4.3
|
83
77
|
signing_key:
|
84
|
-
specification_version:
|
78
|
+
specification_version: 4
|
85
79
|
summary: Output filter plugin to create ticket in redmine
|
86
80
|
test_files:
|
87
81
|
- test/helper.rb
|