Class: Katello::ErrataMailer

Inherits:
ApplicationMailer
  • Object
show all
Defined in:
app/mailers/katello/errata_mailer.rb

Instance Method Summary collapse

Instance Method Details

#host_errata(options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'app/mailers/katello/errata_mailer.rb', line 5

def host_errata(options)
  user = ::User.find(options[:user])
  @hosts = ::Host::Managed.authorized("view_hosts").reject do |host|
    !host.content_facet || host.content_facet.applicable_errata.empty?
  end

  set_locale_for(user) do
    mail(:to => user.mail, :subject => _("Host Errata Advisory"))
  end
end

#promote_errata(options) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/mailers/katello/errata_mailer.rb', line 29

def promote_errata(options)
  user = options[:user]

  @content_view = options[:content_view]
  @environment = options[:environment]
  @content_facets = Katello::Host::ContentFacet.where(:lifecycle_environment_id => @environment.id,
                                                      :content_view_id => @content_view.id)
  @hosts = ::Host::Managed.authorized("view_hosts").where(:id => @content_facets.pluck(:host_id))
  @errata = @content_facets.map(&:installable_errata).flatten.uniq

  set_locale_for(user) do
    mail(:to => user.mail, :subject => (_("Promotion Summary for %{content_view}") % {:content_view => @content_view.name}))
  end
end

#sync_errata(options) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/mailers/katello/errata_mailer.rb', line 16

def sync_errata(options)
  user = options[:user]

  all_errata = options[:errata]
  @repo = options[:repo]
  @errata_counts = errata_counts(all_errata)
  @errata = all_errata.take(100).group_by(&:errata_type)

  set_locale_for(user) do
    mail(:to => user.mail, :subject => (_("Sync Summary for %s") % @repo.name))
  end
end