Hi guys, I have a resource file:
resource_name :send_email
property :text, String, default: 'Unknown’
property :node_name, String, default: 'Unknown’
property :subject, String, default: ‘Chef run’
action :send do
require 'net/smtp’
def_emails = data_bag_item(‘def_settings’, ‘emails’)
message = "From: #{def_emails[‘from’]}>\n"
message << "To: #{def_emails[‘to’]}\n"
message << "Subject: #{subject}\n"
message << "Date: #{Time.now.rfc2822}\n\n"
message << "#{text}\n"
Net::SMTP.start(‘mailhost’, 25) do |smtp|
smtp.send_message message, “#{def_emails[‘from’]}”, "#{def_emails[‘to’]}"
end
end
Is it possible to run this resource in
Chef.event_handler do
on :run_failed do
end
end
It fails when I ran it