summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorMarc Chamberland <mchamberland@pbsc.com>2019-04-14 12:11:53 -0400
committerMarc Chamberland <chamberland.marc@gmail.com>2019-11-04 22:44:15 -0500
commite8dbf50d7800ac6a53aab9ca2f7b5b1812a6d010 (patch)
treea651a0ed64deff55964ae2836c1dcdf2e52634ba /ext
parent262026a09745719784d7fc4b140228912307b4de (diff)
downloadchef-e8dbf50d7800ac6a53aab9ca2f7b5b1812a6d010.tar.gz
dist constants in win logs
Signed-off-by: Marc Chamberland <chamberland.marc@gmail.com>
Diffstat (limited to 'ext')
-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
2 files changed, 13 insertions, 5 deletions
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