fluent-mixin-config-placeholders 0.3.0 → 0.3.1

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: 0ab16700e39c11b456366d81f51f625686a7889d
4
- data.tar.gz: e09c4de8f159953b9500c68c8a77ed614f64282a
3
+ metadata.gz: dcff4739a970ca07132e3ae96ffff5fd92a11177
4
+ data.tar.gz: 635fe9488728a0183b19463b341a390f9ebc8cbc
5
5
  SHA512:
6
- metadata.gz: 63134a44e0f4481383af4a1d36c76670dae38224f221b41e4a24bd13831490782ba4b2995a216a43b98bc5744d06a6e4abdd906557a4ebcf16774b2375265261
7
- data.tar.gz: 3317ac5b2db00ca6c06cb3765853959330dbc4ec293aef51a08118faeeb9370a1f7bf0215e866b2636636af03c59f577168951b025cdb99d5dfa3320fe05268f
6
+ metadata.gz: b07fd967eccd65ba18f3ef5f0ebb3a84df15c247bbb538f3387c8786ea33e3c004c90d8b094efae15257e2b4e35219ac1abeb6a0de6dbf2250c86996a3159a6a
7
+ data.tar.gz: 457928ef1ccaab4d39ac9b904daebdea4f99d79fcf37575cdec3d68ae31028a9ec6efd1a2cb682c13c7b2069279725ea03c50f17fe8a4adb75f3310b5ea79ed8
@@ -1,4 +1,7 @@
1
1
  language: ruby
2
+ sudo: false
2
3
  rvm:
3
- - 1.9.3
4
- - 2.0.0
4
+ - 2.0
5
+ - 2.1
6
+ - 2.2
7
+ - 2.3.0
@@ -1,7 +1,7 @@
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.0"
4
+ gem.version = "0.3.1"
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}
@@ -17,4 +17,5 @@ Gem::Specification.new do |gem|
17
17
  gem.add_runtime_dependency "fluentd"
18
18
  gem.add_runtime_dependency "uuidtools", ">= 2.1.5"
19
19
  gem.add_development_dependency "rake"
20
+ gem.add_development_dependency "test-unit"
20
21
  end
@@ -1,5 +1,6 @@
1
1
  require 'fluent/config'
2
2
  require 'uuidtools'
3
+ require 'socket'
3
4
 
4
5
  module Fluent
5
6
  module Mixin
@@ -47,11 +48,11 @@ module Fluent
47
48
  def configure(conf)
48
49
  # Element#has_key? inserts key name into 'used' list, so we should not use that method...
49
50
  hostname = if conf.keys.include?('hostname') && has_replace_pattern?( conf.fetch('hostname') )
50
- `hostname`.chomp
51
+ Socket.gethostname
51
52
  elsif conf.keys.include?('hostname')
52
53
  conf['hostname']
53
54
  else
54
- `hostname`.chomp
55
+ Socket.gethostname
55
56
  end
56
57
 
57
58
  placeholders = self.respond_to?(:placeholders) ? self.placeholders : PLACEHOLDERS_DEFAULT
@@ -1,6 +1,11 @@
1
1
  require 'helper'
2
+ require 'socket'
2
3
 
3
4
  class ConfigPlaceholdersTest < Test::Unit::TestCase
5
+ def setup
6
+ Fluent::Test.setup
7
+ end
8
+
4
9
  def create_plugin_instances(conf)
5
10
  [
6
11
  Fluent::ConfigPlaceholdersTest0Input, Fluent::ConfigPlaceholdersTest1Input, Fluent::ConfigPlaceholdersTest2Input
@@ -256,7 +261,7 @@ attr1 ${hostname}
256
261
  assert_equal "test.host.local", p1.attr1
257
262
 
258
263
  # this configuration pattern is to set hostname-attribute of plugins
259
- # when 'myhostname' is host name (result of `hostname` shell command),
264
+ # when 'myhostname' is host name (result of Socket.gethostname),
260
265
  # - @hostname is set as 'myhostname.fluentd.local'
261
266
  # - @attr1 should be set as 'myhostname' only, it is default of mixin
262
267
  conf2 = %[
@@ -264,7 +269,7 @@ hostname ${hostname}.fluentd.local
264
269
  attr1 __HOSTNAME__
265
270
  ]
266
271
  p2 = Fluent::Test::InputTestDriver.new(Fluent::ConfigPlaceholdersTest3Input).configure(conf2).instance
267
- hostname_cmd = `hostname`.chomp
272
+ hostname_cmd = Socket.gethostname
268
273
  assert_equal "#{hostname_cmd}.fluentd.local", p2.hostname
269
274
  assert_equal hostname_cmd, p2.attr1
270
275
  end
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.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - TAGOMORI Satoshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-18 00:00:00.000000000 Z
11
+ date: 2016-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: test-unit
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  description: to add various placeholders for plugin configurations
56
70
  email:
57
71
  - tagomoris@gmail.com
@@ -90,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
104
  version: '0'
91
105
  requirements: []
92
106
  rubyforge_project:
93
- rubygems_version: 2.2.2
107
+ rubygems_version: 2.5.1
94
108
  signing_key:
95
109
  specification_version: 4
96
110
  summary: Configuration syntax extension mixin for fluentd plugin