Strict detetction fluent-gem command with setup fluentd/td-agent specific

This commit is contained in:
uu59 2014-07-17 13:51:02 +09:00
parent acfb8eb887
commit b9e4bd7af8

View File

@ -190,11 +190,15 @@ class Plugin
end
def fluent_gem_path
if Fluentd.instance.fluentd?
return "fluent-gem" # maybe `fluent-gem` command is in the $PATH
end
# NOTE: td-agent has a command under the /usr/lib{,64}, td-agent2 has under /opt/td-agent
%W(
fluent-gem
/opt/td-agent/embedded/bin/fluent-gem
/usr/lib/fluent/ruby/bin/fluent-gem
/usr/lib64/fluent/ruby/bin/fluent-gem
/opt/td-agent/embedded/bin/fluent-gem
).find do |path|
system("which #{path}", out: File::NULL, err: File::NULL)
end