Sha256: 28db192837522e337df30cac7d874b33a0a3db6fa270a31a134c723efbe05fbd

Contents?: true

Size: 1.53 KB

Versions: 36

Compression:

Stored size: 1.53 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, 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

36 entries across 36 versions & 1 rubygems

Version Path
katello-3.18.5 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.18.4 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.18.3.1 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.18.3 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.18.2.1 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.18.2 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.17.3 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.18.1.1 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.17.2 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-4.0.0.rc1 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.18.1 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.18.0 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.17.1 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.16.2 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.18.0.rc2.1 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.18.0.rc2 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.17.0 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.18.0.rc1 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.17.0.rc2.2 app/lib/actions/katello/host/erratum/applicable_errata_install.rb
katello-3.17.0.rc2.1 app/lib/actions/katello/host/erratum/applicable_errata_install.rb