summaryrefslogtreecommitdiff
path: root/lib/chef/dsl
diff options
context:
space:
mode:
authorChris Doherty <cdoherty@ooyala.com>2014-09-02 09:14:04 -0700
committerChris Doherty <cdoherty@getchef.com>2014-09-10 16:34:14 -0700
commitda7dddf3d43fffbc38fd48296eb5d4d34467e22d (patch)
tree600920b617a4b9a46b541ab5bf150b7e53f4d9f5 /lib/chef/dsl
parent6ef555bed751f2b8dac01391fdff2c527d947545 (diff)
downloadchef-da7dddf3d43fffbc38fd48296eb5d4d34467e22d.tar.gz
First-pass changes for a core reboot resource. Still uses run_state instead of run_context.
Diffstat (limited to 'lib/chef/dsl')
-rw-r--r--lib/chef/dsl/reboot_pending.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/chef/dsl/reboot_pending.rb b/lib/chef/dsl/reboot_pending.rb
index 9f80d38c61..31e57bf5e6 100644
--- a/lib/chef/dsl/reboot_pending.rb
+++ b/lib/chef/dsl/reboot_pending.rb
@@ -27,10 +27,12 @@ class Chef
include Chef::DSL::PlatformIntrospection
# Returns true if the system needs a reboot or is expected to reboot
- # Raises UnsupportedPlatform if this functionality isn't provided yet
+ # Note that we will silently miss any other platform-specific reboot notices besides Windows+Ubuntu.
def reboot_pending?
- if platform?("windows")
+ if node.run_state[:reboot_requested]
+ true
+ elsif platform?("windows")
# PendingFileRenameOperations contains pairs (REG_MULTI_SZ) of filenames that cannot be updated
# due to a file being in use (usually a temporary file and a system file)
# \??\c:\temp\test.sys!\??\c:\winnt\system32\test.sys
@@ -53,7 +55,7 @@ class Chef
# This should work for Debian as well if update-notifier-common happens to be installed. We need an API for that.
File.exists?('/var/run/reboot-required')
else
- raise Chef::Exceptions::UnsupportedPlatform.new(node[:platform])
+ false
end
end
end