From 2173e31a10e668b8a5c6e088c8d3359333ec13b4 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Mon, 26 Feb 2018 13:44:30 -0800 Subject: Don't use supervisor process for one-shot / command-line runs without --interval we default to --no-fork, with --interval we default to running --fork. --once and --daemonize are handled before this code so they will also DTRT. Signed-off-by: Lamont Granquist --- lib/chef/application/client.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/chef/application') diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb index 0834e5f037..706ba93ca0 100644 --- a/lib/chef/application/client.rb +++ b/lib/chef/application/client.rb @@ -2,7 +2,7 @@ # Author:: AJ Christensen () # Author:: Mark Mzyk (mmzyk@chef.io) -# Copyright:: Copyright 2008-2016, Chef Software, Inc. +# Copyright:: Copyright 2008-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -228,8 +228,7 @@ class Chef::Application::Client < Chef::Application option :client_fork, :short => "-f", :long => "--[no-]fork", - :description => "Fork client", - :boolean => true + :description => "Fork client" option :recipe_url, :long => "--recipe-url=RECIPE_URL", @@ -362,6 +361,11 @@ class Chef::Application::Client < Chef::Application Chef::Config[:splay] = nil end + # supervisor processes are enabled by default for interval-running processes but not for one-shot runs + if Chef::Config[:client_fork].nil? + Chef::Config[:client_fork] = !!Chef::Config[:interval] + end + if !Chef::Config[:client_fork] && Chef::Config[:interval] && !Chef::Platform.windows? Chef::Application.fatal!(unforked_interval_error_message) end -- cgit v1.2.1