summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Doherty <cdoherty@getchef.com>2014-09-03 16:47:09 -0700
committerChris Doherty <cdoherty@getchef.com>2014-09-10 16:34:19 -0700
commit9ad8d3cdeffd2986a2be568f434064f03e692303 (patch)
tree11a58170dd7e55b4bdcc4da8648445080298af94
parenta95d518c810cea761fe529c2cfd2dce7e4afe570 (diff)
downloadchef-9ad8d3cdeffd2986a2be568f434064f03e692303.tar.gz
Various tidying-up.
-rw-r--r--lib/chef/provider/reboot.rb7
-rw-r--r--lib/chef/rebooter.rb1
-rw-r--r--spec/functional/resource/reboot_spec.rb8
3 files changed, 7 insertions, 9 deletions
diff --git a/lib/chef/provider/reboot.rb b/lib/chef/provider/reboot.rb
index 1890c4e8bc..59519b214a 100644
--- a/lib/chef/provider/reboot.rb
+++ b/lib/chef/provider/reboot.rb
@@ -19,13 +19,6 @@
require 'chef/log'
require 'chef/provider'
-if RUBY_PLATFORM =~ /mswin|mingw32|windows/
- require 'win32/registry'
-end
-
-# require 'chef/mixin/shell_out'
-# require 'chef/mixin/command'
-
class Chef
class Provider
class Reboot < Chef::Provider
diff --git a/lib/chef/rebooter.rb b/lib/chef/rebooter.rb
index ab3673c720..fa1aafd81d 100644
--- a/lib/chef/rebooter.rb
+++ b/lib/chef/rebooter.rb
@@ -49,6 +49,7 @@ class Chef
"shutdown -h #{shutdown_time}"
end
Chef::Log.warn "Shutdown command: '#{cmd}'"
+ # for ease of testing we are not yet actually rebooting.
#shell_out!(cmd)
end
diff --git a/spec/functional/resource/reboot_spec.rb b/spec/functional/resource/reboot_spec.rb
index eed521c41e..539e16e862 100644
--- a/spec/functional/resource/reboot_spec.rb
+++ b/spec/functional/resource/reboot_spec.rb
@@ -44,7 +44,7 @@ describe Chef::Resource::Reboot do
# TODO: decide on a behavior for multiple :request and/or :cancel calls, and test for it.
- describe "the request action" do
+ describe 'the request action' do
before do
resource.run_action(:request)
end
@@ -59,6 +59,8 @@ describe Chef::Resource::Reboot do
expect(reboot_info[:delay_mins]).to eq(expected[:delay_mins])
expect(reboot_info[:reason]).to eq(expected[:reason])
expect(reboot_info[:requested_by]).to eq(expected[:requested_by])
+
+ expect(resource.run_context.reboot_requested?).to be_true
end
end
@@ -68,8 +70,10 @@ describe Chef::Resource::Reboot do
resource.run_action(:cancel)
end
- it 'should have cleared the run context reboot data' do
+ it 'should have cleared the reboot request' do
+ # arguably we shouldn't be querying RunContext's internal data directly.
expect(resource.run_context.reboot_info).to eq({})
+ expect(resource.run_context.reboot_requested?).to be_false
end
end
end