This commit is contained in:
uu59 2015-02-04 16:12:05 +09:00
parent a4c88f23aa
commit e0f0ccdc3b
3 changed files with 9 additions and 8 deletions

View File

@ -43,10 +43,7 @@ class Fluentd
end
def dryrun!(file_path = nil)
Bundler.with_clean_env do
system("fluentd -q --dry-run #{options_to_argv(config_file: file_path)}", out: File::NULL, err: File::NULL)
raise ::Fluentd::Agent::ConfigError, last_error_message unless $?.exitstatus.zero?
end
exec_dryrun("fluentd", file_path)
end
def config_syntax_check

View File

@ -82,6 +82,13 @@ class Fluentd
private
def exec_dryrun(exe, file_path = nil)
Bundler.with_clean_env do
system("#{exe} -q --dry-run #{options_to_argv(config_file: file_path)}", out: File::NULL, err: File::NULL)
raise ::Fluentd::Agent::ConfigError, last_error_message unless $?.exitstatus.zero?
end
end
def backup_config
return unless File.exists? config_file

View File

@ -17,10 +17,7 @@ class Fluentd
end
def dryrun!(file_path = nil)
Bundler.with_clean_env do
system("/usr/sbin/td-agent --dry-run #{options_to_argv(config_file: file_path)}", out: File::NULL, err: File::NULL)
raise ::Fluentd::Agent::ConfigError, last_error_message unless $?.exitstatus.zero?
end
exec_dryrun("/usr/sbin/td-agent", file_path)
end
case FluentdUI.platform