Sha256: d7cd2c4a65456fcc560c93c3bb44f35e3747acda4d1894e78bf9afd8ffc9b83a

Contents?: true

Size: 1.45 KB

Versions: 9

Compression:

Stored size: 1.45 KB

Contents

module Actions
  module Katello
    module Host
      module Package
        class Update < Actions::EntryAction
          include Helpers::Presenter

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

            action_subject(host, :packages => packages)
            plan_action(Pulp::Consumer::ContentUpdate,
                        consumer_uuid: host.content_facet.uuid,
                        type:          'rpm',
                        args:          packages)
            plan_self(:host_id => host.id)
          end

          def humanized_name
            _("Update package")
          end

          def humanized_input
            [(input[:packages].present? && input[:packages].join(", ") || "all packages")] + super
          end

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

          def rescue_strategy
            Dynflow::Action::Rescue::Skip
          end

          def finalize
            host = ::Host.find_by(:id => input[:host_id])
            host.update(audit_comment: audit_comment)
          end

          def audit_comment
            if input[:packages].present?
              (_("Update of package(s) requested: %{packages}") % {packages: input[:packages].join(", ")}).truncate(255)
            else
              _("Update of all packages requested")
            end
          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/package/update.rb
katello-3.12.2 app/lib/actions/katello/host/package/update.rb
katello-3.13.0.rc1 app/lib/actions/katello/host/package/update.rb
katello-3.12.1 app/lib/actions/katello/host/package/update.rb
katello-3.11.2 app/lib/actions/katello/host/package/update.rb
katello-3.12.0 app/lib/actions/katello/host/package/update.rb
katello-3.12.0.rc2 app/lib/actions/katello/host/package/update.rb
katello-3.12.0.rc1 app/lib/actions/katello/host/package/update.rb
katello-3.11.1 app/lib/actions/katello/host/package/update.rb