Sha256: 6736168501b8f28e73fb1b6d049f4410adc216d1b2e208f614f973417658ce55

Contents?: true

Size: 1.54 KB

Versions: 75

Compression:

Stored size: 1.54 KB

Contents

module Actions
  module Katello
    module Host
      module Erratum
        class ApplicableErrataInstall < Actions::EntryAction
          include Helpers::Presenter

          #takes a list of errata and schedules the installation of those that are applicable
          def plan(host, options = {})
            fail _("errata_ids or update_all must be provided") if !options[:errata_ids] && !options[:update_all]
            errata_ids = options.fetch(:errata_ids, nil)

            applicable_errata = host.content_facet.applicable_errata
            applicable_errata = applicable_errata.with_identifiers(errata_ids) unless options[:update_all]
            if applicable_errata.empty?
              plan_self(:hostname => host.name, :skip => true)
            else
              plan_action(Actions::Katello::Host::Erratum::Install, host, content: applicable_errata.pluck(:errata_id))
              plan_self(:hostname => host.name, :skip => false)
            end
          end

          def run
            if input[:skip]
              output[:response] = _("No applicable errata for %s, skipping" % input[:hostname])
            end
          end

          def humanized_name
            if input.try(:[], :hostname).nil?
              _("Install Applicable Errata")
            else
              _("Install Applicable Errata on %s") % input[:hostname]
            end
          end

          def presenter
            Helpers::Presenter::Delegated.new(self, planned_actions(Katello::Host::Erratum::Install))
          end
        end
      end
    end
  end
end

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
katello-4.9.2 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.8.4 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.9.1 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.8.3 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.9.0 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.7.6 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.8.2 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.9.0.rc2 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.9.0.rc1 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.8.1 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.7.5 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.8.0 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.8.0.rc2 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.7.4 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.8.0.rc1 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.7.3 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.7.2 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.7.1 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.6.2.1 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.6.2 app/lib/actions/katello/host/erratum/applicable_errata_install.rb