Commit 3a38c555 authored by Phil Dibowitz's avatar Phil Dibowitz Committed by sersut
Browse files

Merge pull request #1315 from jaymzh/fixsignals-11

[11] Don't catch SIGTERM if not in daemon mode
Conflicts:
	CHANGELOG.md
	CONTRIBUTIONS.md
	RELEASE_NOTES.md
parent 180941f6
......@@ -66,6 +66,7 @@
* Fix ImmutableMash and ImmutableArray to_hash and to_a methods (CHEF-5132)
* guard_interpreter attribute: use powershell\_script, other script resources in guards (CHEF-4553)
* Fix for CHEF-5169: add require for chef/config_fetcher
* SIGTERM will once-more kill a non-daemonized chef-client (CHEF-5172)
## Last Release: 11.10.0 (02/06/2014)
......
......@@ -38,3 +38,4 @@ Example Contribution:
* **jessehu**: Increase bootstrap log_level when knife -V -V is set
* **mveitas**: knife cookbook test honors chefignore
* **zuazo**: Fix ImmutableMash and ImmutableArray to_hash and to_a methods
* **jaymzh**: SIGTERM will once-more kill a non-daemonized chef-client (CHEF-5172)
......@@ -192,4 +192,9 @@ Normally Chef would require a major version bump for this change but since the o
If you need to differentiate between OpenSUSE and SUSE in your cookbooks, please make sure the differentiation logic is updated to use the new :platform attribute values rather than the :platform_version in your cookbooks before upgrading to this version.
None.
#### Signal Regression Fix
CHEF-1761 introduced a regression for signal handling when not in daemon mode
(see CHEF-5172). Chef will now, once again, exit immediately on SIGTERM if it
is not in daemon mode, otherwise it will complete it's current run before
existing.
......@@ -295,9 +295,12 @@ class Chef::Application::Client < Chef::Application
SELF_PIPE[1].putc(IMMEDIATE_RUN_SIGNAL) # wakeup master process from select
end
trap("TERM") do
Chef::Log.info("SIGTERM received, exiting gracefully")
SELF_PIPE[1].putc(GRACEFUL_EXIT_SIGNAL)
# see CHEF-5172
if Chef::Config[:daemonize] || Chef::Config[:interval]
trap("TERM") do
Chef::Log.info("SIGTERM received, exiting gracefully")
SELF_PIPE[1].putc(GRACEFUL_EXIT_SIGNAL)
end
end
end
......
......@@ -128,8 +128,10 @@ end
describe Chef::Application::Client, "run_application", :unix_only do
before(:each) do
Chef::Config[:daemonize] = true
@pipe = IO.pipe
@app = Chef::Application::Client.new
Chef::Daemon.stub(:daemonize).and_return(true)
@app.stub(:run_chef_client) do
@pipe[1].puts 'started'
sleep 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment