Skip to content

Commit

Permalink
Change name
Browse files Browse the repository at this point in the history
when not-dry mode(normal mode), do not call dry_run method.

Signed-off-by: Yuta Iwama <[email protected]>
  • Loading branch information
ganmacs committed Oct 15, 2019
1 parent 002d20c commit 3309da9
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions lib/fluent/supervisor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,11 @@ def run_supervisor
end
end

dry_run_cmd if @dry_run
supervise
if @dry_run
dry_run
else
supervise
end
end

def options
Expand Down Expand Up @@ -564,30 +567,25 @@ def create_socket_manager
ENV['SERVERENGINE_SOCKETMANAGER_PATH'] = socket_manager_path.to_s
end

def dry_run_cmd
def dry_run
$log.info "starting fluentd-#{Fluent::VERSION} as dry run mode", ruby: RUBY_VERSION
dry_run
Fluent::Engine.dry_run_mode = true
configure_supervise
exit 0
rescue => e
$log.error "dry run failed: #{e}"
exit 1
end

## Set Engine's dry_run_mode true to override all target_id of worker sections
def dry_run
begin
Fluent::Engine.dry_run_mode = true
change_privilege
MessagePackFactory.init
init_engine(supervisor: true)
run_configure
rescue Fluent::ConfigError => e
$log.error "config error", file: @config_path, error: e
$log.debug_backtrace
exit!(1)
ensure
Fluent::Engine.dry_run_mode = false
end
def configure_supervise
change_privilege
MessagePackFactory.init
init_engine(supervisor: true)
run_configure
rescue Fluent::ConfigError => e
$log.error "config error", file: @config_path, error: e
$log.debug_backtrace
exit!(1)
end

def show_plugin_config
Expand All @@ -597,8 +595,7 @@ def show_plugin_config
end

def supervise
# Make dumpable conf, which is set corresponding_proxies for all elements in all worker sections
dry_run
configure_supervise

Process.setproctitle("supervisor:#{@process_name}") if @process_name
$log.info "starting fluentd-#{Fluent::VERSION}", pid: Process.pid, ruby: RUBY_VERSION
Expand Down

0 comments on commit 3309da9

Please sign in to comment.