summaryrefslogtreecommitdiff
path: root/lib/chef/application
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-02-26 13:44:30 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2018-02-26 13:44:30 -0800
commit2173e31a10e668b8a5c6e088c8d3359333ec13b4 (patch)
treee06ea3f31dfce814aa017f65fe613a797762741f /lib/chef/application
parentb3a9add86336ebc4101fdecb52caa99bc219466b (diff)
downloadchef-2173e31a10e668b8a5c6e088c8d3359333ec13b4.tar.gz
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 <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/application')
-rw-r--r--lib/chef/application/client.rb10
1 files changed, 7 insertions, 3 deletions
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 (<aj@chef.io)
# Author:: Christopher Brown (<cb@chef.io>)
# 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