fluent-plugin-mongo 1.2.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +5 -0
- data/VERSION +1 -1
- data/lib/fluent/plugin/in_mongo_tail.rb +3 -3
- data/lib/fluent/plugin/mongo_auth.rb +12 -10
- data/lib/fluent/plugin/out_mongo.rb +4 -0
- data/test/plugin/test_out_mongo.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb5c56a40c5a058bd8b710af7fe2b065b96b2e0d
|
4
|
+
data.tar.gz: 761f54a14e8dde03a9c669ff89a0dda9d07b84ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9b5368add232fe67d644a95d28e5adbe8f4584f63e67c347effb36b50188b1321f1628d16c4494c1aac404db120edc91ff09558f85ad3a7439310909fc4e4d9
|
7
|
+
data.tar.gz: cd1d6a83f39438d464829baab15d6e9e490fa1b693947111b9ffc7176ff2c8c73673f5c109a562a9d17be447b99cbf59fbb9ebf98ebc04f6ba39cdaafcdb4684
|
data/ChangeLog
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
Release 1.3.0 - 2019/04/24
|
2
|
+
|
3
|
+
* out_mongo: Support auth_mech parameter to allow other authentication
|
4
|
+
* in_mongo_tail: Fix replicat set issue
|
5
|
+
|
1
6
|
Release 1.2.2 - 2019/04/01
|
2
7
|
|
3
8
|
* out_mongo: Don't handle database placholders when specifying connection_string parameter
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.3.0
|
@@ -118,10 +118,10 @@ module Fluent::Plugin
|
|
118
118
|
private
|
119
119
|
|
120
120
|
def client
|
121
|
-
@client_options[:database] = @database
|
121
|
+
@client_options[:database] = @database if @database
|
122
122
|
@client_options[:user] = @user if @user
|
123
123
|
@client_options[:password] = @password if @password
|
124
|
-
Mongo::Client.new(
|
124
|
+
Mongo::Client.new(node_string, @client_options)
|
125
125
|
end
|
126
126
|
|
127
127
|
def get_collection
|
@@ -133,7 +133,7 @@ module Fluent::Plugin
|
|
133
133
|
def node_string
|
134
134
|
case
|
135
135
|
when @database
|
136
|
-
"#{@host}:#{@port}"
|
136
|
+
["#{@host}:#{@port}"]
|
137
137
|
when @url
|
138
138
|
@url
|
139
139
|
end
|
@@ -8,23 +8,25 @@ module Fluent
|
|
8
8
|
config_param :password, :string, default: nil, secret: true
|
9
9
|
desc "MongoDB authentication database"
|
10
10
|
config_param :auth_source, :string, default: nil
|
11
|
+
desc "MongoDB authentication mechanism"
|
12
|
+
config_param :auth_mech, :string, default: nil
|
11
13
|
}
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
15
17
|
module MongoAuth
|
16
18
|
def authenticate(client)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
rescue Mongo::Auth::Unauthorized => e
|
25
|
-
log.fatal e
|
26
|
-
exit!
|
19
|
+
begin
|
20
|
+
if [@user, @password, @auth_source].all?
|
21
|
+
client = client.with(user: @user, password: @password, auth_source: @auth_source)
|
22
|
+
elsif [@user, @password].all?
|
23
|
+
client = client.with(user: @user, password: @password)
|
24
|
+
elsif [@user, @auth_source, @auth_mech].all?
|
25
|
+
client = client.with(user: @user, auth_source: @auth_source, auth_mech: @auth_mech.to_sym)
|
27
26
|
end
|
27
|
+
rescue Mongo::Auth::Unauthorized => e
|
28
|
+
log.fatal e
|
29
|
+
exit!
|
28
30
|
end
|
29
31
|
client
|
30
32
|
end
|
@@ -108,6 +108,10 @@ module Fluent::Plugin
|
|
108
108
|
|
109
109
|
super
|
110
110
|
|
111
|
+
if @auth_mech && !Mongo::Auth::SOURCES.has_key?(@auth_mech.to_sym)
|
112
|
+
raise Fluent::ConfigError, Mongo::Auth::InvalidMechanism.new(@auth_mech.to_sym)
|
113
|
+
end
|
114
|
+
|
111
115
|
if @connection_string.nil? && @database.nil?
|
112
116
|
raise Fluent::ConfigError, "connection_string or database parameter is required"
|
113
117
|
end
|
@@ -92,6 +92,22 @@ class MongoOutputTest < ::Test::Unit::TestCase
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
+
def test_configure_auth_mechanism
|
96
|
+
Mongo::Auth::SOURCES.each do |key, value|
|
97
|
+
conf = default_config + %[
|
98
|
+
auth_mech #{key}
|
99
|
+
]
|
100
|
+
d = create_driver(conf)
|
101
|
+
assert_equal(key.to_s, d.instance.auth_mech)
|
102
|
+
end
|
103
|
+
assert_raise Fluent::ConfigError do
|
104
|
+
conf = default_config + %[
|
105
|
+
auth_mech invalid
|
106
|
+
]
|
107
|
+
d = create_driver(conf)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
95
111
|
def test_configure_with_ssl
|
96
112
|
conf = default_config + %[
|
97
113
|
ssl true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-mongo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro Nakagawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|