Sha256: b95d2b48d5fb4c8bb171839338d47fa2010a9ce2417e7b3b1ef615ec1a7eb004

Contents?: true

Size: 1.83 KB

Versions: 191

Compression:

Stored size: 1.83 KB

Contents

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

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

    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]
      ::User.as(user.login) do
        @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
    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

191 entries across 191 versions & 1 rubygems

Version Path
katello-4.7.6 app/mailers/katello/errata_mailer.rb
katello-4.7.5 app/mailers/katello/errata_mailer.rb
katello-4.7.4 app/mailers/katello/errata_mailer.rb
katello-4.7.3 app/mailers/katello/errata_mailer.rb
katello-4.7.2 app/mailers/katello/errata_mailer.rb
katello-4.7.1 app/mailers/katello/errata_mailer.rb
katello-4.6.2.1 app/mailers/katello/errata_mailer.rb
katello-4.6.2 app/mailers/katello/errata_mailer.rb
katello-4.7.0 app/mailers/katello/errata_mailer.rb
katello-4.6.1 app/mailers/katello/errata_mailer.rb
katello-4.7.0.rc2 app/mailers/katello/errata_mailer.rb
katello-4.7.0.rc1 app/mailers/katello/errata_mailer.rb
katello-4.4.2.2 app/mailers/katello/errata_mailer.rb
katello-4.4.2.1 app/mailers/katello/errata_mailer.rb
katello-4.4.2 app/mailers/katello/errata_mailer.rb
katello-4.5.1 app/mailers/katello/errata_mailer.rb
katello-4.6.0 app/mailers/katello/errata_mailer.rb
katello-4.6.0.rc2 app/mailers/katello/errata_mailer.rb
katello-4.6.0.rc1 app/mailers/katello/errata_mailer.rb
katello-4.5.0 app/mailers/katello/errata_mailer.rb