Sha256: 1d60e312e467ee80455f2d0225fc8f6c333d9cc2fedc5db9d005b744e4bce582

Contents?: true

Size: 1.72 KB

Versions: 10

Compression:

Stored size: 1.72 KB

Contents

module Katello
  class ErrataMailer < ApplicationMailer
    helper :'katello/errata_mailer'

    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

    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

    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

    private

    def errata_counts(errata)
      counts = {:total => errata.count}
      counts.merge(Hash[[:security, :bugfix, :enhancement].collect do |errata_type|
        [errata_type, errata.send(errata_type).count]
      end])
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
katello-3.1.0.rc2.1 app/mailers/katello/errata_mailer.rb
katello-3.0.2 app/mailers/katello/errata_mailer.rb
katello-3.1.0.rc1 app/mailers/katello/errata_mailer.rb
katello-3.0.1 app/mailers/katello/errata_mailer.rb
katello-3.0.0 app/mailers/katello/errata_mailer.rb
katello-3.0.0.rc7 app/mailers/katello/errata_mailer.rb
katello-3.0.0.rc5 app/mailers/katello/errata_mailer.rb
katello-3.0.0.rc4 app/mailers/katello/errata_mailer.rb
katello-3.0.0.rc3 app/mailers/katello/errata_mailer.rb
katello-3.0.0.rc2 app/mailers/katello/errata_mailer.rb