summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorben Knerr <mail@tknerr.de>2015-03-24 01:02:44 +0100
committerBryan McLellan <btm@chef.io>2015-03-27 13:34:54 -0700
commit8aa3200b5fb25a1eea5e593e5c45bd4adacfb9b2 (patch)
tree2731487d91736ed84f505aad760ca4f347da06f9
parent8bb31f986e19d108485312e6b20524b38f2facae (diff)
downloadchef-8aa3200b5fb25a1eea5e593e5c45bd4adacfb9b2.tar.gz
allow for the chef gem installation to succeed even without elevated privileges, skip the event log registration in this case
-rw-r--r--ext/win32-eventlog/Rakefile16
1 files changed, 10 insertions, 6 deletions
diff --git a/ext/win32-eventlog/Rakefile b/ext/win32-eventlog/Rakefile
index 3112c27e8e..63fae1e73b 100644
--- a/ext/win32-eventlog/Rakefile
+++ b/ext/win32-eventlog/Rakefile
@@ -41,10 +41,14 @@ end
task :register => EVT_SHARED_OBJECT do
require 'win32/eventlog'
dll_file = File.expand_path(EVT_SHARED_OBJECT)
- Win32::EventLog.add_event_source(
- :source => "Application",
- :key_name => "Chef",
- :event_message_file => dll_file,
- :category_message_file => dll_file
- )
+ begin
+ Win32::EventLog.add_event_source(
+ :source => "Application",
+ :key_name => "Chef",
+ :event_message_file => dll_file,
+ :category_message_file => dll_file
+ )
+ rescue Errno::EIO => e
+ puts "Skipping event log registration due to missing privileges: #{e}"
+ end
end