Add dryrun method to agents

This commit is contained in:
uu59 2015-01-14 13:38:14 +09:00
parent 8119c5222e
commit f80ab8a69a
3 changed files with 16 additions and 5 deletions

View File

@ -5,7 +5,7 @@ class Fluentd
include LocalCommon
def self.default_options
{
{
:pid_file => "#{ENV["HOME"]}/.fluentd-ui/fluent.pid",
:log_file => "#{ENV["HOME"]}/.fluentd-ui/fluent.log",
:config_file => "#{ENV["HOME"]}/.fluentd-ui/fluent.conf",
@ -42,6 +42,12 @@ class Fluentd
actual_reload
end
def dryrun
Bundler.with_clean_env do
system("fluentd --dry-run #{options_to_argv}")
end
end
def version
Bundler.with_clean_env do
`fluentd --version`.strip
@ -60,9 +66,7 @@ class Fluentd
end
def validate_fluentd_options
Bundler.with_clean_env do
system("fluentd --dry-run #{options_to_argv}")
end
dryrun
end
def actual_start

View File

@ -2,7 +2,6 @@ class Fluentd
class Agent
class TdAgent
module Macosx
def start
backup_running_config do
detached_command("launchctl load #{plist}") && pid_from_launchctl
@ -17,6 +16,10 @@ class Fluentd
stop && start
end
def dryrun
detached_command("/usr/sbin/td-agent --dry-run -q --use-v1-config -c #{config_file} -o #{log_file}")
end
private
def plist

View File

@ -17,6 +17,10 @@ class Fluentd
# https://github.com/treasure-data/td-agent/blob/master/debian/td-agent.init#L156
detached_command('/etc/init.d/td-agent restart')
end
def dryrun
detached_command('/etc/init.d/td-agent configtest')
end
end
end
end