Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From: Christopher Huhn <C.Huhn@gsi.de>
Date: Tue, 9 Nov 2021 18:42:28 +0100
Subject: options is an instance variable, not local
---
lib/chef/handler/mail.rb | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/lib/chef/handler/mail.rb b/lib/chef/handler/mail.rb
index 3be01cc..9497f83 100644
--- a/lib/chef/handler/mail.rb
+++ b/lib/chef/handler/mail.rb
@@ -37,12 +37,12 @@ class MailHandler < Chef::Handler
Socket.gethostname
)
- Chef::Log.debug("mail handler template path: #{options[:template_path]}")
- if File.exists? options[:template_path]
- template = IO.read(options[:template_path]).chomp
+ Chef::Log.debug("mail handler template path: #{@options[:template_path]}")
+ if File.exists? @options[:template_path]
+ template = IO.read(@options[:template_path]).chomp
else
Chef::Log.error("mail handler template not found: " +
- options[:template_path])
+ @options[:template_path])
raise Errno::ENOENT
end
@@ -54,12 +54,9 @@ class MailHandler < Chef::Handler
bodystr = Erubis::Eruby.new(template).evaluate(context)
- to_address = options[:to_address]
- from_address = "chef-client@#{Socket.gethostname}"
-
mail = Mail.new do
- from options[:from_address]
- to to_address
+ from @options[:from_address]
+ to @options[:to_address]
subject subjectstr
body bodystr
end