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:51:44 -0800 |
commit | ede404fef4ae02cccca0f8ca653b2200d76a1679 (patch) | |
tree | 73e40ee4af350a0fe7b455c5a973ca65d3a433bd | |
parent | 870febcea33c655842234ceec55b02d4306bbed7 (diff) | |
parent | 8a1abefb363874fd0e02885db1e2799b96ac01ff (diff) | |
download | chef-ede404fef4ae02cccca0f8ca653b2200d76a1679.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' |