Sha256: 1a11162d1d8ef6a1dbc4610463064cc6864525dcab3d739a585d9a5c3d6562a7

Contents?: true

Size: 1.21 KB

Versions: 9

Compression:

Stored size: 1.21 KB

Contents

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

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

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

          def humanized_name
            _("Install package")
          end

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

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

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

          def finalize
            host = ::Host.find_by(:id => input[:host_id])
            host.update(audit_comment: (_("Installation of package(s) requested: %{packages}") % {packages: input[:packages].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/package/install.rb
katello-3.12.2 app/lib/actions/katello/host/package/install.rb
katello-3.13.0.rc1 app/lib/actions/katello/host/package/install.rb
katello-3.12.1 app/lib/actions/katello/host/package/install.rb
katello-3.11.2 app/lib/actions/katello/host/package/install.rb
katello-3.12.0 app/lib/actions/katello/host/package/install.rb
katello-3.12.0.rc2 app/lib/actions/katello/host/package/install.rb
katello-3.12.0.rc1 app/lib/actions/katello/host/package/install.rb
katello-3.11.1 app/lib/actions/katello/host/package/install.rb