Sha256: 8463c54fece28f65041444e4c16198c55526bf0287d8f8bf549b09c589e99ba3

Contents?: true

Size: 1.6 KB

Versions: 59

Compression:

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

59 entries across 59 versions & 1 rubygems

Version Path
katello-3.16.1.2 app/lib/actions/katello/host/package/update.rb
katello-3.16.1.1 app/lib/actions/katello/host/package/update.rb
katello-3.17.0.rc2 app/lib/actions/katello/host/package/update.rb
katello-3.16.1 app/lib/actions/katello/host/package/update.rb
katello-3.17.0.rc1 app/lib/actions/katello/host/package/update.rb
katello-3.16.0 app/lib/actions/katello/host/package/update.rb
katello-3.16.0.rc5.1 app/lib/actions/katello/host/package/update.rb
katello-3.16.0.rc5 app/lib/actions/katello/host/package/update.rb
katello-3.16.0.rc4.1 app/lib/actions/katello/host/package/update.rb
katello-3.15.3.1 app/lib/actions/katello/host/package/update.rb
katello-3.15.3 app/lib/actions/katello/host/package/update.rb
katello-3.16.0.rc4 app/lib/actions/katello/host/package/update.rb
katello-3.16.0.rc3.1 app/lib/actions/katello/host/package/update.rb
katello-3.15.2 app/lib/actions/katello/host/package/update.rb
katello-3.16.0.rc3 app/lib/actions/katello/host/package/update.rb
katello-3.16.0.rc2.1 app/lib/actions/katello/host/package/update.rb
katello-3.16.0.rc2 app/lib/actions/katello/host/package/update.rb
katello-3.15.1.1 app/lib/actions/katello/host/package/update.rb
katello-3.16.0.rc1.1 app/lib/actions/katello/host/package/update.rb
katello-3.15.1 app/lib/actions/katello/host/package/update.rb