kisoku / chef-handler-mail Goto Github PK
View Code? Open in Web Editor NEWsend chef reports via email
License: Apache License 2.0
send chef reports via email
License: Apache License 2.0
I tried this handler on omnibus installed chef in ubuntu oneric.
chef_gem 'chef-handler-mail'
gem 'chef-handler-mail'
chef_handler "MailHandler" do
source 'chef/handler/mail'
arguments :to_address => "[email protected]"
action :nothing
end.run_action(:enable)
But it errors out complaining about highline gem not found but its installed already.
The trace is at https://gist.github.com/3148965
And the following is the gems installed. highline
is also already installed.
ubuntu@ip-10-202-66-91:~$ /opt/chef/embedded/bin/gem list
*** LOCAL GEMS ***
bundler (1.0.22)
bunny (0.7.9)
chef (10.12.0, 10.12.0.rc.1)
chef-handler-mail (0.1.2)
erubis (2.7.0)
highline (1.6.13, 1.6.12)
i18n (0.6.0)
ipaddress (0.8.0)
json (1.6.1)
mail (2.4.4)
mime-types (1.18)
minitest (1.6.0)
mixlib-authentication (1.1.4)
mixlib-cli (1.2.2)
mixlib-config (1.1.2)
mixlib-log (1.3.0)
mixlib-shellout (1.0.0)
moneta (0.6.0)
net-ssh (2.2.2)
net-ssh-gateway (1.1.0)
net-ssh-multi (1.1)
ohai (6.14.0)
polyglot (0.3.3)
pony (1.4)
rake (0.8.7)
rdoc (2.5.8)
rest-client (1.6.7)
right_aws (2.1.0)
right_http_connection (1.3.0)
systemu (2.5.1)
treetop (1.4.10)
uuidtools (2.1.2)
yajl-ruby (1.1.0)
I'm defining the MailHandler class in /etc/chef/client.rb like so:
exception_handlers << MailHandler.new(:to_address => "[email protected]")
however when it runs, it still sends mail to root@localhost.
I'm using the chef-client
cookbook to install handler and I've enabled it in the following way:
default.chef_client.load_gems = {
"chef-handler-mail" => {
"require_name" => 'chef/handler/mail',
}
}
default.chef_client.config.report_handlers = [
{ "class" => "MailHandler", "arguments" => [{:to_address => "[email protected]"}] }
]
When I use the chef-client
cookbook to manage the handler it creates the following line (amonth the others) in Chef config:
report_handlers << MailHandler.new({"to_address"=>"[email protected]"})
Notice that a symbol has changed to string here.
This means that we can't pass any parameters to the handler using chef-client
cookbook as the handler accepts only symbols.
Deprecated features used!
"method access to node attributes (node.foo.bar) is deprecated and will be removed in Chef 13, please use bracket syntax (node["foo"]["bar"]) at 3 locations:
- /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-handler-mail-0.1.2/lib/chef/handler/mail.rb:36:in `report'
- (erubis):1:in `block in evaluate'
- /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-handler-mail-0.1.2/lib/chef/handler/mail.rb:55:in `report'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.