summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore6
-rw-r--r--ext/win32-eventlog/Rakefile10
-rw-r--r--ext/win32-eventlog/chef-log.man.erb (renamed from ext/win32-eventlog/chef-log.man)8
3 files changed, 19 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 353c84ce3c..ed1d93ca31 100644
--- a/.gitignore
+++ b/.gitignore
@@ -72,3 +72,9 @@ chef-bin/pkg
# auto generated docs from the docs.rb rake task
docs_site
+
+# Rendered Templates
+ext/win32-eventlog/chef-log.man
+
+# tool logs
+ext/win32-eventlog/mkmf.log
diff --git a/ext/win32-eventlog/Rakefile b/ext/win32-eventlog/Rakefile
index a4f032d04e..6f59f096a3 100644
--- a/ext/win32-eventlog/Rakefile
+++ b/ext/win32-eventlog/Rakefile
@@ -1,6 +1,8 @@
require "rubygems"
require "rake"
require "mkmf"
+require "erb"
+require "chef/dist"
desc "Building event log dll"
@@ -12,6 +14,12 @@ def ensure_present(commands)
end
end
+# Templating the windows event log messages
+# So we can inject distro constants in there
+template = ERB.new(IO.read("chef-log.man.erb"))
+chef_log_man = template.result
+File.open("chef-log.man", "w") { |f| f.write(chef_log_man) }
+
EVT_MC_FILE = "chef-log.man".freeze
EVT_RC_FILE = "chef-log.rc".freeze
EVT_RESOURCE_OBJECT = "resource.o".freeze
@@ -43,7 +51,7 @@ task register: EVT_SHARED_OBJECT do
begin
Win32::EventLog.add_event_source(
source: "Application",
- key_name: "Chef",
+ key_name: Chef::Dist::PRODUCT,
event_message_file: dll_file,
category_message_file: dll_file
)
diff --git a/ext/win32-eventlog/chef-log.man b/ext/win32-eventlog/chef-log.man.erb
index dade288b85..2e767a8cfe 100644
--- a/ext/win32-eventlog/chef-log.man
+++ b/ext/win32-eventlog/chef-log.man.erb
@@ -1,25 +1,25 @@
MessageId=10000
SymbolicName=RUN_START
Language=English
-Starting Chef Infra Client run v%1
+Starting <%= Chef::Dist::PRODUCT %> run v%1
.
MessageId=10001
SymbolicName=RUN_STARTED
Language=English
-Started Chef Infra Client run %1
+Started <%= Chef::Dist::PRODUCT %> run %1
.
MessageId=10002
SymbolicName=RUN_COMPLETED
Language=English
-Completed Chef Infra Client run %1 in %2 seconds
+Completed <%= Chef::Dist::PRODUCT %> run %1 in %2 seconds
.
MessageId=10003
SymbolicName=RUN_FAILED
Language=English
-Failed Chef Infra Client run %1 in %2 seconds.%n
+Failed <%= Chef::Dist::PRODUCT %> run %1 in %2 seconds.%n
Exception type: %3%n
Exception message: %4%n
Exception backtrace: %5%n