Skip to content

Commit 6d53664

Browse files
committed
Call dup not to overwrite original value
Signed-off-by: Yuta Iwama <ganmacs@gmail.com>
1 parent 38f80c5 commit 6d53664

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

lib/fluent/config/section.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ def to_h
5858
@params
5959
end
6060

61+
def dup
62+
Section.new(@params.dup, @corresponding_config_element.dup)
63+
end
64+
6165
def +(other)
6266
Section.new(self.to_h.merge(other.to_h))
6367
end

lib/fluent/plugin_helper/http_server.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def stop
115115
private
116116

117117
def _http_server_overwrite_config(config, opts)
118-
conf = config
118+
conf = config.dup
119119
Fluent::PluginHelper::Server::SERVER_TRANSPORT_PARAMS.map(&:to_s).each do |param|
120120
if opts.key?(param)
121121
conf[param] = opts[param]

test/config/test_section.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ class TestSection < ::Test::Unit::TestCase
4040
assert_equal("email", s1.send)
4141
assert_equal("normal", s1.klass)
4242
assert_equal(5, s1.keys)
43-
44-
assert_raise(NoMethodError) { s1.dup }
4543
end
4644

4745
test 'creates object which contains specified hash object itself, including fields with at prefix' do

0 commit comments

Comments
 (0)