Sha256: da4faa8c24d648908656d3dd42e885eaad570c313966447ff4695950aaf2f1d9

Contents?: true

Size: 1.66 KB

Versions: 9

Compression:

Stored size: 1.66 KB

Contents

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

          def plan(host, errata_ids)
            Type! host, ::Host::Managed

            action_subject(host, :errata => errata_ids)
            if Setting['erratum_install_batch_size'] && Setting['erratum_install_batch_size'] > 0
              errata_ids.each_slice(Setting['erratum_install_batch_size']) do |errata_ids_batch|
                plan_action(Pulp::Consumer::ContentInstall,
                            consumer_uuid: host.content_facet.uuid,
                            type:          'erratum',
                            args:          errata_ids_batch)
              end
            else
              plan_action(Pulp::Consumer::ContentInstall,
                          consumer_uuid: host.content_facet.uuid,
                          type:          'erratum',
                          args:          errata_ids)
            end
            plan_self(:host_id => host.id)
          end

          def humanized_name
            _("Install erratum")
          end

          def humanized_input
            [input[:errata].join(", ")] + super
          end

          def resource_locks
            :link
          end

          def presenter
            Helpers::Presenter::Delegated.new(self, planned_actions(Pulp::Consumer::ContentInstall))
          end

          def finalize
            host = ::Host.find_by(:id => input[:host_id])
            host.update(audit_comment: _("Installation of errata requested: %{errata}") % {errata: input[:errata].join(", ")})
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
katello-3.10.2 app/lib/actions/katello/host/erratum/install.rb
katello-3.10.1.1 app/lib/actions/katello/host/erratum/install.rb
katello-3.10.1 app/lib/actions/katello/host/erratum/install.rb
katello-3.11.0 app/lib/actions/katello/host/erratum/install.rb
katello-3.11.0.rc2 app/lib/actions/katello/host/erratum/install.rb
katello-3.11.0.rc1 app/lib/actions/katello/host/erratum/install.rb
katello-3.10.0 app/lib/actions/katello/host/erratum/install.rb
katello-3.10.0.rc1.1 app/lib/actions/katello/host/erratum/install.rb
katello-3.10.0.rc1 app/lib/actions/katello/host/erratum/install.rb