summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-02-26 15:28:51 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2018-02-26 15:28:51 -0800
commit87ed3914d735a2c486900a86bb7ab66bc8ad08d3 (patch)
treed48b51382fb6734d031b247ff5bce40a0c4d161a
parentdd4ee7acf0044e6e9c0400d13a980c446dc3f529 (diff)
downloadchef-87ed3914d735a2c486900a86bb7ab66bc8ad08d3.tar.gz
fix legacy mode and legacy mode tests
also more broadly applies the integration tests to legacy mode which was the original intent of the chef-solo tests in client_spec.rb here Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/application/solo.rb10
-rw-r--r--spec/integration/client/client_spec.rb2
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/chef/application/solo.rb b/lib/chef/application/solo.rb
index 6b4aef42b4..f8502edc38 100644
--- a/lib/chef/application/solo.rb
+++ b/lib/chef/application/solo.rb
@@ -1,7 +1,7 @@
#
# Author:: AJ Christensen (<aj@chef.io>)
# Author:: Mark Mzyk (mmzyk@chef.io)
-# Copyright:: Copyright 2008-2018, 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");
@@ -175,8 +175,7 @@ class Chef::Application::Solo < Chef::Application
option :client_fork,
:short => "-f",
:long => "--[no-]fork",
- :description => "Fork client",
- :boolean => true
+ :description => "Fork client"
option :why_run,
:short => "-W",
@@ -261,6 +260,11 @@ class Chef::Application::Solo < Chef::Application
Chef::Config[:interval] ||= 1800
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
+
Chef::Application.fatal!(unforked_interval_error_message) if !Chef::Config[:client_fork] && Chef::Config[:interval]
if Chef::Config[:recipe_url]
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb
index 730e304bd5..77008524c8 100644
--- a/spec/integration/client/client_spec.rb
+++ b/spec/integration/client/client_spec.rb
@@ -46,7 +46,7 @@ describe "chef-client" do
# we're running `chef-client` from the source tree and not the external one.
# cf. CHEF-4914
let(:chef_client) { "ruby '#{chef_dir}/chef-client' --minimal-ohai" }
- let(:chef_solo) { "ruby '#{chef_dir}/chef-solo' --minimal-ohai" }
+ let(:chef_solo) { "ruby '#{chef_dir}/chef-solo' --legacy-mode --minimal-ohai" }
let(:critical_env_vars) { %w{_ORIGINAL_GEM_PATH GEM_PATH GEM_HOME GEM_ROOT BUNDLE_BIN_PATH BUNDLE_GEMFILE RUBYLIB RUBYOPT RUBY_ENGINE RUBY_ROOT RUBY_VERSION PATH}.map { |o| "#{o}=#{ENV[o]}" } .join(" ") }