summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Dibowitz <phil@ipom.com>2014-04-01 12:33:32 -0700
committerPhil Dibowitz <phil@ipom.com>2014-04-01 12:33:32 -0700
commitc914b9740781da98543e9b7dc345f5763bbee8d6 (patch)
tree56ad36a7ac1b7ce4cd2f88b433d7b71917a0098b
parent932d7656ff4d8afcb672359b1d622d64a4adc15e (diff)
parent5f8fbd346f44c978b597246a78bbc6b91253a02c (diff)
downloadchef-c914b9740781da98543e9b7dc345f5763bbee8d6.tar.gz
Merge pull request #1315 from jaymzh/fixsignals-11
[11] Don't catch SIGTERM if not in daemon 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