Sha256: 516231221591ccb59de2f0f177d14f427f26316fb95e20fdb96a962e6448358e

Contents?: true

Size: 1.21 KB

Versions: 8

Compression:

Stored size: 1.21 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]
            plan_action(Actions::Katello::Host::Erratum::Install, host, applicable_errata.pluck(:errata_id))
            plan_self(:hostname => host.name)
          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

8 entries across 8 versions & 1 rubygems

Version Path
katello-3.15.3.1 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.15.3 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.15.2 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.15.1.1 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.15.1 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.15.0.1 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.15.0 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.15.0.rc2 app/lib/actions/katello/host/erratum/applicable_errata_install.rb