Sha256: 90ef531579afa1cd01a1caf81c3980152de51339d48a9b577f61495abde124de

Contents?: true

Size: 1.42 KB

Versions: 75

Compression:

Stored size: 1.42 KB

Contents

module Actions
  module Katello
    module Host
      module Package
        class Remove < Actions::Katello::AgentAction
          def self.agent_message
            :remove_package
          end

          def agent_action_type
            :content_uninstall
          end

          def humanized_name
            if input.try(:[], :hostname)
              _("Remove package for %s") % input[:hostname]
            else
              _("Remove package")
            end
          end

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

          def humanized_package_names
            input[:content].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 finalize
            host = ::Host.find_by(:id => input[:host_id])
            host.update(audit_comment: (_("Removal of package(s) requested: %{packages}") % {packages: input[:content].join(", ")}).truncate(255))
          end
        end
      end
    end
  end
end

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
katello-4.9.2 app/lib/actions/katello/host/package/remove.rb
katello-4.8.4 app/lib/actions/katello/host/package/remove.rb
katello-4.9.1 app/lib/actions/katello/host/package/remove.rb
katello-4.8.3 app/lib/actions/katello/host/package/remove.rb
katello-4.9.0 app/lib/actions/katello/host/package/remove.rb
katello-4.7.6 app/lib/actions/katello/host/package/remove.rb
katello-4.8.2 app/lib/actions/katello/host/package/remove.rb
katello-4.9.0.rc2 app/lib/actions/katello/host/package/remove.rb
katello-4.9.0.rc1 app/lib/actions/katello/host/package/remove.rb
katello-4.8.1 app/lib/actions/katello/host/package/remove.rb
katello-4.7.5 app/lib/actions/katello/host/package/remove.rb
katello-4.8.0 app/lib/actions/katello/host/package/remove.rb
katello-4.8.0.rc2 app/lib/actions/katello/host/package/remove.rb
katello-4.7.4 app/lib/actions/katello/host/package/remove.rb
katello-4.8.0.rc1 app/lib/actions/katello/host/package/remove.rb
katello-4.7.3 app/lib/actions/katello/host/package/remove.rb
katello-4.7.2 app/lib/actions/katello/host/package/remove.rb
katello-4.7.1 app/lib/actions/katello/host/package/remove.rb
katello-4.6.2.1 app/lib/actions/katello/host/package/remove.rb
katello-4.6.2 app/lib/actions/katello/host/package/remove.rb