summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerdar Sutay <serdar@opscode.com>2014-12-08 18:49:23 -0800
committerSerdar Sutay <serdar@opscode.com>2014-12-08 18:50:48 -0800
commit9e5179261e250900a28d0eaffcc51681bc92b649 (patch)
tree55779f6ae0cc75b7f8571fede4d4425304209b72
parent767531c46719f1274a0d4d210cc3ff9c0f50b97d (diff)
downloadchef-9e5179261e250900a28d0eaffcc51681bc92b649.tar.gz
Merge pull request #2572 from opscode/sersut/win-fork-interval
Fix windows service when :interval is set Conflicts: CHANGELOG.md
-rw-r--r--CHANGELOG.md1
-rw-r--r--lib/chef/application/client.rb4
-rw-r--r--spec/unit/application/client_spec.rb12
3 files changed, 16 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f3b2f9c7ff..2f7840332a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
* [Issue 2552](https://github.com/opscode/chef/issues/2552) Create constant for LWRP before calling `provides`
* [Issue 2545](https://github.com/opscode/chef/issues/2545) `path` attribute of `execute` resource is restored to provide backwards compatibility with Chef 11.
* [Issue 2565](https://github.com/opscode/chef/issues/2565) Fix `Chef::Knife::Core::BootstrapContext` constructor for knife-windows compat.
+* [Issue 2566](https://github.com/opscode/chef/issues/2566) Make sure Client doesn't raise error when interval is set on Windows.
## 12.0.0
diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb
index 5463f504bc..295dc2470e 100644
--- a/lib/chef/application/client.rb
+++ b/lib/chef/application/client.rb
@@ -272,7 +272,9 @@ class Chef::Application::Client < Chef::Application
Chef::Config[:splay] = nil
end
- Chef::Application.fatal!(unforked_interval_error_message) if !Chef::Config[:client_fork] && Chef::Config[:interval]
+ if !Chef::Config[:client_fork] && Chef::Config[:interval] && !Chef::Platform.windows?
+ Chef::Application.fatal!(unforked_interval_error_message)
+ end
if Chef::Config[:json_attribs]
config_fetcher = Chef::ConfigFetcher.new(Chef::Config[:json_attribs])
diff --git a/spec/unit/application/client_spec.rb b/spec/unit/application/client_spec.rb
index ee91e67256..a91209cfee 100644
--- a/spec/unit/application/client_spec.rb
+++ b/spec/unit/application/client_spec.rb
@@ -63,6 +63,18 @@ Enable chef-client interval runs by setting `:client_fork = true` in your config
end
end
+ context "when interval is given on windows" do
+ before do
+ Chef::Config[:interval] = 600
+ allow(Chef::Platform).to receive(:windows?).and_return(true)
+ end
+
+ it "should not terminate" do
+ expect(Chef::Application).not_to receive(:fatal!)
+ @app.reconfigure
+ end
+ end
+
context "when configured to run once" do
before do
Chef::Config[:once] = true