Sha256: 7bc5a68174f1b9bf21b292cb28587eac627ac53deb00316a69f349d9b66c0eda

Contents?: true

Size: 1.67 KB

Versions: 9

Compression:

Stored size: 1.67 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(", ")}).truncate(255))
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
katello-3.12.3 app/lib/actions/katello/host/erratum/install.rb
katello-3.12.2 app/lib/actions/katello/host/erratum/install.rb
katello-3.13.0.rc1 app/lib/actions/katello/host/erratum/install.rb
katello-3.12.1 app/lib/actions/katello/host/erratum/install.rb
katello-3.11.2 app/lib/actions/katello/host/erratum/install.rb
katello-3.12.0 app/lib/actions/katello/host/erratum/install.rb
katello-3.12.0.rc2 app/lib/actions/katello/host/erratum/install.rb
katello-3.12.0.rc1 app/lib/actions/katello/host/erratum/install.rb
katello-3.11.1 app/lib/actions/katello/host/erratum/install.rb