logstash-output-redmine 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 94e8619a521cb614e2ae5da0b8d0173771551daa
4
- data.tar.gz: faf7e7da86b59bc95f3656208d2179aac6d9ccaa
3
+ metadata.gz: 359835469dc33469ef1ee1625b4ab9bf13dc3f66
4
+ data.tar.gz: 7087e1bb48a2e1bf09ab7a67ee1ad847a5af088a
5
5
  SHA512:
6
- metadata.gz: 3f44cfc6ab54f0abc38ba3be81e29923d3fe5bf87f43d0b17f65e7fb178ada9884afb43c37263c3ad68b12dc3b704f9c6ec896e8ce5861f5ae92f06ca5c3d424
7
- data.tar.gz: 247e5f8407389da07e9117a8c4dc85036fbdbc8e42cd5b7d1525612ccc476fd232153ef20750e750d41829b526c46a92f0dea1a6ec22aa1a2fd78aeb8384ca3d
6
+ metadata.gz: 93259f43677e1a652cf236492164882a1743cf7ae61d93c945e539083ed1150715af9b663c860336ac0b1e787792d7f969355e4707c697e947dddd9051757b1b
7
+ data.tar.gz: 9a1510aada185fe7b323d23f6067f7bf9d937f3b851561b105cf45fa99ad95b88429d39a10d8ea9c7f0d63d3312708fa5745a32ed27fcb155fd9329b70381923
data/CHANGELOG.md ADDED
File without changes
data/NOTICE.TXT ADDED
@@ -0,0 +1,5 @@
1
+ Elasticsearch
2
+ Copyright 2012-2015 Elasticsearch
3
+
4
+ This product includes software developed by The Apache Software
5
+ Foundation (http://www.apache.org/).
data/README.md CHANGED
@@ -13,7 +13,7 @@ Logstash provides infrastructure to automatically generate documentation for thi
13
13
 
14
14
  ## Need Help?
15
15
 
16
- Need help? Try #logstash on freenode IRC or the logstash-users@googlegroups.com mailing list.
16
+ Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
17
17
 
18
18
  ## Developing
19
19
 
@@ -1,8 +1,9 @@
1
1
  # encoding: utf-8
2
2
  require "logstash/outputs/base"
3
3
  require "logstash/namespace"
4
+ require "logstash/json"
4
5
 
5
- # The redmine output is used to create a ticket via the API redmine.
6
+ # The redmine output is used to create a ticket via the API redmine.
6
7
  #
7
8
  # It send a POST request in a JSON format and use TOKEN authentication
8
9
  # This output provide ssl connection method but does not check the certificate
@@ -34,32 +35,32 @@ class LogStash::Outputs::Redmine < LogStash::Outputs::Base
34
35
 
35
36
  # http request ssl trigger
36
37
  # not required
37
- config :ssl, :validate => :boolean, :default => false
38
+ config :ssl, :validate => :boolean, :default => false
38
39
 
39
40
  # redmine token user used for authentication
40
41
  # required
41
42
  config :token, :validate => :string, :required => true
42
43
 
43
- # redmine issue projet_id
44
- # required
44
+ # redmine issue projet_id
45
+ # required
45
46
  config :project_id, :validate => :number, :required => true
46
47
 
47
48
  # redmine issue tracker_id
48
- # required
49
+ # required
49
50
  config :tracker_id, :validate => :number, :required => true
50
51
 
51
52
  # redmine issue status_id
52
- # required
53
- config :status_id, :validate => :number, :required => true
53
+ # required
54
+ config :status_id, :validate => :number, :required => true
54
55
 
55
56
  # redmine issue priority_id
56
- # required
57
+ # required
57
58
  config :priority_id, :validate => :number, :required => true
58
59
 
59
60
  # redmine issue subject
60
- # required
61
+ # required
61
62
  config :subject, :validate => :string, :default => "%{host}"
62
-
63
+
63
64
  # redmine issue description
64
65
  # required
65
66
  config :description, :validate => :string, :default => "%{message}"
@@ -67,7 +68,7 @@ class LogStash::Outputs::Redmine < LogStash::Outputs::Base
67
68
  # redmine issue assigned_to
68
69
  # not required for post_issue
69
70
  config :assigned_to_id, :validate => :number, :default => nil
70
-
71
+
71
72
  # redmine issue parent_issue_id
72
73
  # not required for post_issue
73
74
  config :parent_issue_id, :validate => :number, :default => nil
@@ -84,27 +85,27 @@ class LogStash::Outputs::Redmine < LogStash::Outputs::Base
84
85
  def register
85
86
 
86
87
  require 'net/http'
87
- require 'uri'
88
+ require 'uri'
88
89
 
89
90
  # url form
90
91
  # TODO : Add a mecanism that verify and format this value
91
92
  @post_format = 'json'
92
93
  @formated_url = "#{@url}/issues.#{@post_format}"
93
94
  @uri = URI(@formated_url)
94
- @logger.debug("formated_uri:",:uri => @formated_url)
95
-
95
+ @logger.debug("formated_uri:",:uri => @formated_url)
96
+
96
97
  #http prepare
97
98
  @http = Net::HTTP.new(@uri.host, @uri.port)
98
- @header = { 'Content-Type' => 'application/json', 'X-Redmine-Api-Key' => "#{@token}" }
99
+ @header = { 'Content-Type' => 'application/json', 'X-Redmine-Api-Key' => "#{@token}" }
99
100
  @req = Net::HTTP::Post.new(@uri.path, @header)
100
101
  @logger.debug("request instancied with:", :uri_path => @uri.path, :header => @header )
101
-
102
+
102
103
  #ssl verify
103
- if @ssl == true
104
+ if @ssl == true
104
105
  @logger.info("ssl use detected", :ssl => @ssl)
105
106
  @http.use_ssl = true
106
107
  # disable ssl certificate verification
107
- @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
108
+ @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
108
109
  end
109
110
 
110
111
  end # def register
@@ -113,13 +114,13 @@ class LogStash::Outputs::Redmine < LogStash::Outputs::Base
113
114
  def receive(event)
114
115
 
115
116
  return unless output?(event)
116
-
117
+
117
118
  if event == LogStash::SHUTDOWN
118
119
  finished
119
120
  return
120
121
  end
121
122
 
122
- # interpolate parameters
123
+ # interpolate parameters
123
124
  description = event.sprintf(@description)
124
125
  subject = event.sprintf(@subject)
125
126
 
@@ -133,20 +134,20 @@ class LogStash::Outputs::Redmine < LogStash::Outputs::Base
133
134
  "subject" => "#{subject}",
134
135
  "description" => "#{description}"
135
136
  }
136
- }
137
+ }
137
138
 
138
139
  # Add "not required" issue parameters in the issue hash
139
140
  @issue["issue"]["assigned_to_id"] = "#{@assigned_to_id}" if not @assigned_to_id.nil?
140
- @issue["issue"]["parent_issue_id"] = "#{@parent_issue_id}" if not @parent_issue_id.nil?
141
+ @issue["issue"]["parent_issue_id"] = "#{@parent_issue_id}" if not @parent_issue_id.nil?
141
142
  @issue["issue"]["category_id"] = "#{@category_id}" if not @category_id.nil?
142
143
  @issue["issue"]["fixed_version_id"] = "#{@fixed_version_id}" if not @fixed_version_id.nil?
143
144
 
144
145
  # change hash issue to json for the request
145
- @req.body = @issue.to_json
146
-
147
- # send the post_http_request "req"
146
+ @req.body = LogStash::Json.dump(@issue)
147
+
148
+ # send the post_http_request "req"
148
149
  @logger.info("Sending request to redmine :", :host => @formated_url, :body => @req.body)
149
- begin
150
+ begin
150
151
  @http.request(@req)
151
152
  rescue => e
152
153
  @logger.warn("Skipping redmine output; error during request post", "error" => $!, "missed_event" => event)
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-output-redmine'
4
- s.version = '0.1.4'
4
+ s.version = '0.1.5'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "The redmine output is used to create a ticket via the API redmine."
7
7
  s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
metadata CHANGED
@@ -1,17 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-redmine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-20 00:00:00.000000000 Z
11
+ date: 2015-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- requirement: !ruby/object:Gem::Requirement
14
+ name: logstash-core
15
+ version_requirements: !ruby/object:Gem::Requirement
15
16
  requirements:
16
17
  - - '>='
17
18
  - !ruby/object:Gem::Version
@@ -19,10 +20,7 @@ dependencies:
19
20
  - - <
20
21
  - !ruby/object:Gem::Version
21
22
  version: 2.0.0
22
- name: logstash-core
23
- prerelease: false
24
- type: :runtime
25
- version_requirements: !ruby/object:Gem::Requirement
23
+ requirement: !ruby/object:Gem::Requirement
26
24
  requirements:
27
25
  - - '>='
28
26
  - !ruby/object:Gem::Version
@@ -30,20 +28,22 @@ dependencies:
30
28
  - - <
31
29
  - !ruby/object:Gem::Version
32
30
  version: 2.0.0
31
+ prerelease: false
32
+ type: :runtime
33
33
  - !ruby/object:Gem::Dependency
34
- requirement: !ruby/object:Gem::Requirement
34
+ name: logstash-devutils
35
+ version_requirements: !ruby/object:Gem::Requirement
35
36
  requirements:
36
37
  - - '>='
37
38
  - !ruby/object:Gem::Version
38
39
  version: '0'
39
- name: logstash-devutils
40
- prerelease: false
41
- type: :development
42
- version_requirements: !ruby/object:Gem::Requirement
40
+ requirement: !ruby/object:Gem::Requirement
43
41
  requirements:
44
42
  - - '>='
45
43
  - !ruby/object:Gem::Version
46
44
  version: '0'
45
+ prerelease: false
46
+ type: :development
47
47
  description: This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program
48
48
  email: info@elastic.co
49
49
  executables: []
@@ -51,9 +51,11 @@ extensions: []
51
51
  extra_rdoc_files: []
52
52
  files:
53
53
  - .gitignore
54
+ - CHANGELOG.md
54
55
  - CONTRIBUTORS
55
56
  - Gemfile
56
57
  - LICENSE
58
+ - NOTICE.TXT
57
59
  - README.md
58
60
  - Rakefile
59
61
  - lib/logstash/outputs/redmine.rb