Project

General

Profile

« Previous | Next » 

Revision feacea35

Added by Amos Benari about 11 years ago

  • ID feacea35f07f362d9e2c694a83516bbc902321a0

upgrade foreman to rails 3.2.13

This commit updates from rails 3.0.x to 3.2.x, main changes include:

  • Asset pipline support
  • cleanup of existing assets (javascript, css, images)

Users who uses foreman in production, make sure that you now compile
your assets, e.g

rake assets:precompile

Paired-with: Joseph Mitchell Magen <>
Paired-with: Ohad Levy <>

Signed-off-by: Ohad Levy <>

View differences:

app/models/host_mailer.rb
class HostMailer < ActionMailer::Base
helper :reports
default :from => Setting["email_reply_address"], :content_type => "text/html"
# sends out a summary email of hosts and their metrics (e.g. how many changes failures etc).
......
end
name,value = options[:factname],options[:factvalue]
if name and value
facthosts = Host.with_fact(name,value)
facthosts = Host.search_for("facts.#{name}=#{value}")
raise "unable to find any hosts with the fact name=#{name} and value=#{value}" if facthosts.empty?
filter << "Fact #{name}=#{value}"
# if environment and facts are defined together, we use a merge of both
......
end
email = options[:email] || Setting[:administrator]
raise "unable to find recipients" if email.empty?
recipients email
from Setting["email_reply_address"]
sent_on Time.now
time = options[:time] || 1.day.ago
host_data = Report.summarise(time, hosts.all).sort
total_metrics = {"failed"=>0, "restarted"=>0, "skipped"=>0, "applied"=>0, "failed_restarts"=>0}
......
total_metrics["failed_restarts"] += data_hash[:metrics]["failed_restarts"]
end
total = 0 ; total_metrics.values.each { |v| total += v }
subject "Summary Puppet report from Foreman - F:#{total_metrics["failed"]} R:#{total_metrics["restarted"]} S:#{total_metrics["skipped"]} A:#{total_metrics["applied"]} FR:#{total_metrics["failed_restarts"]} T:#{total}"
content_type "text/html"
subject = "Summary Puppet report from Foreman - F:#{total_metrics["failed"]} R:#{total_metrics["restarted"]} S:#{total_metrics["skipped"]} A:#{total_metrics["applied"]} FR:#{total_metrics["failed_restarts"]} T:#{total}"
@hosts = host_data
@timerange = time
@out_of_sync = hosts.out_of_sync
@disabled = hosts.alerts_disabled
@filter = filter
mail(:to => email, :subnet => subject)
end
def error_state(report)
......
email = host.owner.recipients if SETTINGS[:login] and not host.owner.nil?
email = Setting[:administrator] if email.empty?
raise "unable to find recipients" if email.empty?
recipients email
from Setting["email_reply_address"]
subject "Puppet error on #{host.to_label}"
sent_on Time.now
content_type "text/html"
@report = report
@host = host
mail(:to => email, :subject => "Puppet error on #{host.to_label}")
end
end

Also available in: Unified diff