fluent-plugin-mobile-carrier 0.0.1 → 0.0.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20be1c78bf84e8b363f212e110a376e2bca311b2
|
4
|
+
data.tar.gz: 2d75667be13afef1b4a956eba1d0e6380db8f972
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85d4a6a0d9a1d1677b6092fabb5032b78fa76151db1df89e481303a8b8d3427a3100e9e40484ae1b51080de2242b24f20179e3b5bb8e30c61e7161d521b9325c
|
7
|
+
data.tar.gz: 56e529ba4933c5d94820b94ee1306000c537921d21e5542b9033c81d1c158cb4f996f4ad55d241d5610361fb948f36a58bc2ac9dcd1dc8926830ba0baac66b4d
|
@@ -19,9 +19,9 @@ class Fluent::MobileCarrierOutput < Fluent::Output
|
|
19
19
|
|
20
20
|
def configure(conf)
|
21
21
|
super
|
22
|
-
|
23
|
-
raise '
|
24
|
-
@config =
|
22
|
+
config = YAML.load_file(@config_yaml)
|
23
|
+
raise 'invalid yaml' unless (config.is_a? Hash)
|
24
|
+
@config = parse_config(config)
|
25
25
|
|
26
26
|
if !@tag && !@remove_prefix && !@add_prefix
|
27
27
|
fail Fluent::ConfigError, 'missing both of remove_prefix and add_prefix'
|
@@ -55,7 +55,7 @@ class Fluent::MobileCarrierOutput < Fluent::Output
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
def
|
58
|
+
def parse_config(raw_config)
|
59
59
|
config = {}
|
60
60
|
raw_config.each { |carrier, ip_address_list|
|
61
61
|
config[carrier] = ip_address_list.map { |ip_address|
|
@@ -0,0 +1 @@
|
|
1
|
+
vaofgewa
|
@@ -19,6 +19,29 @@ config_yaml test/data/config1.yaml
|
|
19
19
|
key_name ip
|
20
20
|
unknown_carrier unknown
|
21
21
|
out_key_mobile_carrier mc
|
22
|
+
]
|
23
|
+
|
24
|
+
CONFIG_ERROR1 = %[
|
25
|
+
type mobile_carrier
|
26
|
+
remove_prefix test
|
27
|
+
add_prefix merged
|
28
|
+
key_name ip_address
|
29
|
+
]
|
30
|
+
|
31
|
+
CONFIG_ERROR2 = %[
|
32
|
+
type mobile_carrier
|
33
|
+
remove_prefix test
|
34
|
+
add_prefix merged
|
35
|
+
key_name ip_address
|
36
|
+
config_yaml test/data/not_found.yaml
|
37
|
+
]
|
38
|
+
|
39
|
+
CONFIG_ERROR3 = %[
|
40
|
+
type mobile_carrier
|
41
|
+
remove_prefix test
|
42
|
+
add_prefix merged
|
43
|
+
key_name ip_address
|
44
|
+
config_yaml test/data/wrong.yaml
|
22
45
|
]
|
23
46
|
|
24
47
|
def create_driver(conf = CONFIG1, tag = 'test')
|
@@ -43,6 +66,18 @@ out_key_mobile_carrier mc
|
|
43
66
|
|
44
67
|
assert_equal 'unknown', d.instance.unknown_carrier
|
45
68
|
assert_equal 'mc', d.instance.out_key_mobile_carrier
|
69
|
+
|
70
|
+
assert_raise_with_message(Fluent::ConfigError, "'config_yaml' parameter is required") do
|
71
|
+
d = create_driver CONFIG_ERROR1
|
72
|
+
end
|
73
|
+
|
74
|
+
assert_raise(Errno::ENOENT) do
|
75
|
+
d = create_driver CONFIG_ERROR2
|
76
|
+
end
|
77
|
+
|
78
|
+
assert_raise(RuntimeError) do
|
79
|
+
d = create_driver CONFIG_ERROR3
|
80
|
+
end
|
46
81
|
end
|
47
82
|
|
48
83
|
def test_tag_mangle
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-mobile-carrier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HARUYAMA Seigo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -55,6 +55,7 @@ files:
|
|
55
55
|
- lib/fluent/plugin/.rubocop.yml
|
56
56
|
- lib/fluent/plugin/out_mobile_carrier.rb
|
57
57
|
- test/data/config1.yaml
|
58
|
+
- test/data/wrong.yaml
|
58
59
|
- test/helper.rb
|
59
60
|
- test/plugin/.rubocop.yml
|
60
61
|
- test/plugin/test_out_mobile_carrier.rb
|
@@ -84,6 +85,7 @@ specification_version: 4
|
|
84
85
|
summary: Fluentd plugin to judge mobile carrier by ip address.
|
85
86
|
test_files:
|
86
87
|
- test/data/config1.yaml
|
88
|
+
- test/data/wrong.yaml
|
87
89
|
- test/helper.rb
|
88
90
|
- test/plugin/.rubocop.yml
|
89
91
|
- test/plugin/test_out_mobile_carrier.rb
|