From b9fa5d3a7d2cde64f29ff09d03953b05f8d98cde Mon Sep 17 00:00:00 2001 From: uu59 Date: Thu, 3 Jul 2014 14:46:00 +0900 Subject: [PATCH] Fix to find td-agent' fluent-gem command --- app/models/plugin.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/models/plugin.rb b/app/models/plugin.rb index 750500f..9511e00 100644 --- a/app/models/plugin.rb +++ b/app/models/plugin.rb @@ -195,10 +195,21 @@ class Plugin # NOTE: use `fluent-gem` instead of `gem` Bundler.with_clean_env do # NOTE: this app is under the Bundler, so call `system` in with_clean_env is Bundler jail breaking - unless system(*%W(fluent-gem) + commands) # TODO: should grab stdout/stderr + unless system(* [fluent_gem_path, *commands]) raise GemError, "failed command #{commands.join(" ")}" end end true end + + def fluent_gem_path + %W( + 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 + end end