diff options
author | Serdar Sutay <serdar@opscode.com> | 2014-12-08 18:51:44 -0800 |
---|---|---|
committer | Serdar Sutay <serdar@opscode.com> | 2014-12-08 18:52:11 -0800 |
commit | 36351214c9f2430c8a6aa5a2aa2bb0ec78dccd3f (patch) | |
tree | 8f93597c4cf6d1b968a6c42cb82cbc62e173b6df | |
parent | 9e5179261e250900a28d0eaffcc51681bc92b649 (diff) | |
download | chef-36351214c9f2430c8a6aa5a2aa2bb0ec78dccd3f.tar.gz |
Merge pull request #2574 from opscode/jdm/evt-log-const
Fix issue where Windows::Constants could potentially not exist, causing win event log module to crash
-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' |