Sha256: 557207ff41b98c05b1f81e6115eb9a0bf60e357a5b2c647dd78c49023f5a687a

Contents?: true

Size: 1.83 KB

Versions: 59

Compression:

Stored size: 1.83 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, :hostname => host.name, :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
            if input.try(:[], :hostname)
              _("Install erratum for %s") % input[:hostname]
            else
              _("Install erratum")
            end
          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

59 entries across 59 versions & 1 rubygems

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