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
15
16
# File 'app/mailers/katello/errata_mailer.rb', line 5

def host_errata(options)
  user = ::User.find(options[:user])
  ::User.as(user.) do
    @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
end

#promote_errata(options) ⇒ Object



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

def promote_errata(options)
  user = options[:user]
  ::User.as(user.) do
    @content_view = options[:content_view]
    @environment = options[:environment]
    @content_facets = Katello::Host::ContentFacet.with_content_views(@content_view).with_environments(@environment)
    @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
end

#sync_errata(options) ⇒ Object



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

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