summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--CONTRIBUTIONS.md1
-rw-r--r--RELEASE_NOTES.md6
-rw-r--r--lib/chef/application/client.rb9
-rw-r--r--spec/unit/application/client_spec.rb2
5 files changed, 16 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 31b4972179..b27153eba8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,5 +3,6 @@
## Unreleased
## Last Release: 11.12.0 RC1 (03/31/2014)
+* SIGTERM will once-more kill a non-daemonized chef-client (CHEF-5172)
http://www.getchef.com/blog/2014/03/31/release-candidates-chef-client-11-12-0-10-32-0/
diff --git a/CONTRIBUTIONS.md b/CONTRIBUTIONS.md
index 97c9f2b973..2d5cb27a8f 100644
--- a/CONTRIBUTIONS.md
+++ b/CONTRIBUTIONS.md
@@ -6,3 +6,4 @@ Example Contribution:
-->
# Chef Client Contributions:
+* **jaymzh**: SIGTERM will once-more kill a non-daemonized chef-client (CHEF-5172)
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index dbde23c0fb..52e1a19749 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -8,3 +8,9 @@ Details about the thing that changed that needs to get included in the Release N
-->
# Chef Client Release Notes:
+#### 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.
diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb
index c579fe4ba1..4c37a2a66b 100644
--- a/lib/chef/application/client.rb
+++ b/lib/chef/application/client.rb
@@ -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
diff --git a/spec/unit/application/client_spec.rb b/spec/unit/application/client_spec.rb
index f57fd6875a..90a468b0a2 100644
--- a/spec/unit/application/client_spec.rb
+++ b/spec/unit/application/client_spec.rb
@@ -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