Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems'
- require 'net/ssh'
- module TotalReport
- class SSH < Chef::Handler
- def initialize(ssh_user,ssh_password,ssh_server)
- @ssh_user = ssh_user
- @ssh_password = ssh_password
- @ssh_server = ssh_server
- end
- def report
- message = "Chef run failed on #{node.name} with this error #{run_status.formatted_exception}\n"
- message << Array(backtrace).join("\n")
- Net::SSH.start(:host => @ssh_server,:user => @ssh_user,:password => @ssh_password) do|ssh|
- ssh.exec! "echo #{message} >> /var/log/chef/report/#{node.name}"
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement