diff options
author | Chris Doherty <cdoherty@getchef.com> | 2014-09-04 12:20:19 -0700 |
---|---|---|
committer | Chris Doherty <cdoherty@getchef.com> | 2014-09-10 16:34:22 -0700 |
commit | c62aae31840d3a9b2bc179273ace9e54690a311d (patch) | |
tree | be6a99cb7821885a8fd2b83402474af066c7111c /lib | |
parent | ff9cab9346fdf285e33bb12724b791c1428772b1 (diff) | |
download | chef-c62aae31840d3a9b2bc179273ace9e54690a311d.tar.gz |
In specs, and possibly elsewhere, Chef::DSL::RebootPending can get mixed in without a #node available. Decline to crash in those situations.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/dsl/reboot_pending.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/chef/dsl/reboot_pending.rb b/lib/chef/dsl/reboot_pending.rb index 5255cf1166..a81debce99 100644 --- a/lib/chef/dsl/reboot_pending.rb +++ b/lib/chef/dsl/reboot_pending.rb @@ -30,7 +30,8 @@ class Chef # Note that we will silently miss any other platform-specific reboot notices besides Windows+Ubuntu. def reboot_pending? - if node.run_context.reboot_requested? + # don't break when used as a mixin in contexts without #node (e.g. specs). + if self.respond_to?(:node, true) && node.run_context.reboot_requested? true elsif platform?("windows") # PendingFileRenameOperations contains pairs (REG_MULTI_SZ) of filenames that cannot be updated |