diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2014-12-08 16:07:30 -0800 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2014-12-08 16:07:30 -0800 |
commit | 8a1abefb363874fd0e02885db1e2799b96ac01ff (patch) | |
tree | 734d9d7117706e9c923c6210a41c1e6a13a8b466 /lib/chef/event_loggers | |
parent | 6abcfbf4531d9375093d0bc1664f9126ac1df21a (diff) | |
download | chef-8a1abefb363874fd0e02885db1e2799b96ac01ff.tar.gz |
Fix issue where Windows::Constants could potentially not exist, causing win event log module to crash
Fix for Issue #2560
Diffstat (limited to 'lib/chef/event_loggers')
-rw-r--r-- | lib/chef/event_loggers/windows_eventlog.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/chef/event_loggers/windows_eventlog.rb b/lib/chef/event_loggers/windows_eventlog.rb index 6d45d4fab4..6f5ef627fb 100644 --- a/lib/chef/event_loggers/windows_eventlog.rb +++ b/lib/chef/event_loggers/windows_eventlog.rb @@ -20,9 +20,11 @@ require 'chef/event_loggers/base' require 'chef/platform/query_helpers' if Chef::Platform::windows? and not Chef::Platform::windows_server_2003? - [:INFINITE, :WAIT_FAILED, :FORMAT_MESSAGE_IGNORE_INSERTS, :ERROR_INSUFFICIENT_BUFFER].each do |c| - # These are redefined in 'win32/eventlog' - Windows::Constants.send(:remove_const, c) + if defined? Windows::Constants + [:INFINITE, :WAIT_FAILED, :FORMAT_MESSAGE_IGNORE_INSERTS, :ERROR_INSUFFICIENT_BUFFER].each do |c| + # These are redefined in 'win32/eventlog' + Windows::Constants.send(:remove_const, c) if Windows::Constants.const_defined? c + end end require 'win32/eventlog' |