Sha256: d68d4509a7c92e75b7a3110ee5aa84a3c3cc9fdda7ded6b00c1c8a8f4c453a22

Contents?: true

Size: 1.4 KB

Versions: 9

Compression:

Stored size: 1.4 KB

Contents

module Actions
  module Katello
    module System
      module Package
        class Remove < Actions::EntryAction
          include Helpers::Presenter

          def plan(system, packages)
            action_subject(system, :packages => packages)
            plan_action(Pulp::Consumer::ContentUninstall,
                        consumer_uuid: system.uuid,
                        type:          'rpm',
                        args:          packages)
          end

          def humanized_name
            _("Remove package")
          end

          def humanized_input
            [humanized_package_names.join(', ')] + super
          end

          def humanized_package_names
            input[:packages].inject([]) do |result, package|
              if package.is_a?(Hash)
                new_name = package.include?(:name) ? package[:name] : ""
                new_name += '-' + package[:version] if package.include?(:version)
                new_name += '.' + package[:release] if package.include?(:release)
                new_name += '.' + package[:arch] if package.include?(:arch)
                result << new_name
              else
                result << package
              end
            end
          end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
katello-2.4.5 app/lib/actions/katello/system/package/remove.rb
katello-2.4.4 app/lib/actions/katello/system/package/remove.rb
katello-2.4.3 app/lib/actions/katello/system/package/remove.rb
katello-2.4.2 app/lib/actions/katello/system/package/remove.rb
katello-2.4.1 app/lib/actions/katello/system/package/remove.rb
katello-2.4.0 app/lib/actions/katello/system/package/remove.rb
katello-2.4.0.rc3 app/lib/actions/katello/system/package/remove.rb
katello-2.4.0.rc2 app/lib/actions/katello/system/package/remove.rb
katello-2.4.0.rc1 app/lib/actions/katello/system/package/remove.rb