From d81e2b16f96f9bea4bfe85e2d3018bbcfb487fc5 Mon Sep 17 00:00:00 2001 From: Lucas Barros Date: Sun, 15 Nov 2026 22:09:52 -0300 Subject: [PATCH] Raise Fluent::ConfigError for obsoleted uuid placeholders in path verify_config_placeholders_in_path! raised a bare ConfigError, which does not resolve inside Fluent::Plugin::WebHDFSOutput. A path with ${uuid:hostname}, %{uuid:timestamp} or the other obsoleted placeholders failed with NameError ("unexpected error" at startup) instead of a configuration error. Signed-off-by: Lucas Barros --- lib/fluent/plugin/out_webhdfs.rb | 2 +- test/plugin/test_out_webhdfs.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/fluent/plugin/out_webhdfs.rb b/lib/fluent/plugin/out_webhdfs.rb index 1b187fc..607b813 100644 --- a/lib/fluent/plugin/out_webhdfs.rb +++ b/lib/fluent/plugin/out_webhdfs.rb @@ -334,7 +334,7 @@ def verify_config_placeholders_in_path!(conf) log.error "configuration placeholder #{ph} is now unsupported by webhdfs output plugin." end end - raise ConfigError, "there are unsupported placeholders in path." + raise Fluent::ConfigError, "there are unsupported placeholders in path." end end diff --git a/test/plugin/test_out_webhdfs.rb b/test/plugin/test_out_webhdfs.rb index 1627b6c..4ba76aa 100644 --- a/test/plugin/test_out_webhdfs.rb +++ b/test/plugin/test_out_webhdfs.rb @@ -183,6 +183,20 @@ def test_placeholders_old_style assert_equal '/hdfs/testing.node.local/file.%Y%m%d%H.log', d.instance.path end + data("${uuid:hostname}" => "/hdfs/path/file.${uuid:hostname}.log", + "%{uuid:timestamp}" => "/hdfs/path/file.%{uuid:timestamp}.log", + "__UUID_HOSTNAME__" => "/hdfs/path/file.__UUID_HOSTNAME__.log") + test "obsoleted uuid placeholders raise ConfigError" do |path| + conf = config_element( + "ROOT", "", { + "namenode" => "server.local:50070", + "path" => path + }) + assert_raise Fluent::ConfigError.new("there are unsupported placeholders in path.") do + create_driver(conf) + end + end + data("%Y%m%d" => ["/hdfs/path/file.%Y%m%d.log", "/hdfs/path/file.20120718.log"], "%Y%m%d.%H%M" => ["/hdfs/path/file.%Y%m%d.%H%M.log", "/hdfs/path/file.20120718.1503.log"]) test "generate_path" do |(path, expected)|