diff options
author | Chris Doherty <cdoherty@ooyala.com> | 2014-09-03 13:10:58 -0700 |
---|---|---|
committer | Chris Doherty <cdoherty@getchef.com> | 2014-09-10 16:34:16 -0700 |
commit | 494d2b5c32c7295fc4f0c95b0ca01af65f7c80c3 (patch) | |
tree | 1a3e0baeb2a86c623fdb4feb360628faa7955b7d | |
parent | 3d4b96deb09366abf6f55a92d7c63a70de8f1147 (diff) | |
download | chef-494d2b5c32c7295fc4f0c95b0ca01af65f7c80c3.tar.gz |
Log shutdown command string.
-rw-r--r-- | lib/chef/rebooter.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/chef/rebooter.rb b/lib/chef/rebooter.rb index 1c9c7bb5e8..83bc40c7ad 100644 --- a/lib/chef/rebooter.rb +++ b/lib/chef/rebooter.rb @@ -18,6 +18,7 @@ require 'chef/dsl/reboot_pending' require 'chef/log' +require 'chef/platform' # this encapsulates any and all gnarly stuff needed to reboot the server. @@ -26,6 +27,7 @@ class Chef class Rebooter # below are awkward contortions to re-use the RebootPending code. include Chef::DSL::RebootPending + include Chef::Mixin::ShellOut attr_reader :node, :reboot_info @@ -36,6 +38,14 @@ class Chef def reboot! Chef::Log.warn "Totally would have rebooted here. #{@reboot_info.inspect}" + cmd = if Chef::Platform.windows? + "shutdown /r /t #{reboot_info[:timeout]} /c \"#{reboot_info[:reason]}\"" + else + shutdown_time = reboot_info[:reboot_timeout] > 0 ? reboot_info[:reboot_timeout] : "now" + "shutdown -h #{shutdown_time}" + end + # shell_out!(cmd) + Chef::Log.warn "Shutdown command: '#{cmd}'" end def self.reboot_if_needed!(node) |