fluent-mixin-config-placeholders 0.3.1 → 0.4.0

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: dcff4739a970ca07132e3ae96ffff5fd92a11177
4
- data.tar.gz: 635fe9488728a0183b19463b341a390f9ebc8cbc
3
+ metadata.gz: c7a2fe0e7f28bf92a6aed3c3cf5a0f66a00a767f
4
+ data.tar.gz: d1eb3d95d934817acc48a4e045903f0844ab1acf
5
5
  SHA512:
6
- metadata.gz: b07fd967eccd65ba18f3ef5f0ebb3a84df15c247bbb538f3387c8786ea33e3c004c90d8b094efae15257e2b4e35219ac1abeb6a0de6dbf2250c86996a3159a6a
7
- data.tar.gz: 457928ef1ccaab4d39ac9b904daebdea4f99d79fcf37575cdec3d68ae31028a9ec6efd1a2cb682c13c7b2069279725ea03c50f17fe8a4adb75f3310b5ea79ed8
6
+ metadata.gz: c8f65e4d625b2f951ac8d51b0922f428a2d6a4c1c433828c3513f8e7d881d95eaba6a90b8e711117d8c8010537175e9abe76fc3d2cda62be26321c1e27d7959e
7
+ data.tar.gz: 7f29b1f4cd01c41e17f998adf72cb3f43ce63204fb9ad7bacdd65087cd0c300525e850987a002bad19757547dc75f0746625595c88d24aac207f7b27c71a2725
@@ -1,13 +1,13 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |gem|
3
3
  gem.name = "fluent-mixin-config-placeholders"
4
- gem.version = "0.3.1"
4
+ gem.version = "0.4.0"
5
5
  gem.authors = ["TAGOMORI Satoshi"]
6
6
  gem.email = ["tagomoris@gmail.com"]
7
7
  gem.description = %q{to add various placeholders for plugin configurations}
8
8
  gem.summary = %q{Configuration syntax extension mixin for fluentd plugin}
9
9
  gem.homepage = "https://github.com/tagomoris/fluent-mixin-config-placeholders"
10
- gem.license = "APLv2"
10
+ gem.license = "Apache-2.0"
11
11
 
12
12
  gem.files = `git ls-files`.split($\)
13
13
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -1,5 +1,4 @@
1
1
  require 'fluent/config'
2
- require 'uuidtools'
3
2
  require 'socket'
4
3
 
5
4
  module Fluent
@@ -24,14 +23,17 @@ module Fluent
24
23
  # => #<UUID:0x2adfdc UUID:64a5189c-25b3-11da-a97b-00c04fd430c8>
25
24
 
26
25
  def uuid_random
26
+ require 'uuidtools'
27
27
  UUIDTools::UUID.random_create.to_s
28
28
  end
29
29
 
30
30
  def uuid_hostname(hostname)
31
+ require 'uuidtools'
31
32
  UUIDTools::UUID.sha1_create(UUIDTools::UUID_DNS_NAMESPACE, hostname).to_s
32
33
  end
33
34
 
34
35
  def uuid_timestamp
36
+ require 'uuidtools'
35
37
  UUIDTools::UUID.timestamp_create.to_s
36
38
  end
37
39
 
@@ -90,7 +92,7 @@ module Fluent
90
92
  end
91
93
  end
92
94
 
93
- def check_element(map,c)
95
+ check_element = ->(map, c) {
94
96
  c.arg = replace(map, c.arg)
95
97
  c.keys.each do |k|
96
98
  v = c.fetch(k, nil)
@@ -98,10 +100,9 @@ module Fluent
98
100
  c[k] = replace(map, v)
99
101
  end
100
102
  end
101
- c.elements.each{|e| check_element(map,e)}
102
- end
103
-
104
- check_element(mapping,conf)
103
+ c.elements.each{|e| check_element.call(map,e)}
104
+ }
105
+ check_element.call(mapping,conf)
105
106
 
106
107
  super
107
108
  end
@@ -23,6 +23,7 @@ unless ENV.has_key?('VERBOSE')
23
23
  $log = nulllogger
24
24
  end
25
25
 
26
+ require 'fluent/input'
26
27
  require 'fluent/mixin/config_placeholders'
27
28
  require_relative 'plugin'
28
29
 
@@ -218,7 +218,7 @@ path /path/to/file.log
218
218
  require 'uuidtools'
219
219
  uuid = UUIDTools::UUID.sha1_create(UUIDTools::UUID_DNS_NAMESPACE, "test.host.local").to_s
220
220
 
221
- p1, p2, p3 = create_plugin_instances(conf)
221
+ _p1, _p2, p3 = create_plugin_instances(conf)
222
222
  assert_equal "config", p3.conf.elements.first.name
223
223
  assert_equal "test.host.local", p3.conf.elements.first.arg
224
224
  assert_equal "val1." + uuid, p3.conf.elements.first['var']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-mixin-config-placeholders
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - TAGOMORI Satoshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-21 00:00:00.000000000 Z
11
+ date: 2016-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -86,7 +86,7 @@ files:
86
86
  - test/plugin.rb
87
87
  homepage: https://github.com/tagomoris/fluent-mixin-config-placeholders
88
88
  licenses:
89
- - APLv2
89
+ - Apache-2.0
90
90
  metadata: {}
91
91
  post_install_message:
92
92
  rdoc_options: []