Sha256: 3c5b19b933ea5f1d03e6fcf081df53a933179537106272ad800a1f0171cc2b84
Contents?: true
Size: 842 Bytes
Versions: 16
Compression:
Stored size: 842 Bytes
Contents
module Katello class HostPackagePresenter < SimpleDelegator attr_accessor :installed_package, :upgradable_versions, :rpm_id def initialize(installed_package, upgradable_versions, rpm_id) @installed_package = installed_package @upgradable_versions = upgradable_versions @rpm_id = rpm_id super(@installed_package) end def self.with_latest(packages, host) upgradable_packages_map = ::Katello::Rpm.installable_for_hosts([host]).select(:id, :name, :nvra, :evr).order(evr: :desc).all.group_by(&:name) installed_packages_map = ::Katello::Rpm.where(nvra: packages.map(&:nvra)).select(:id, :name).group_by(&:name) packages.map do |p| HostPackagePresenter.new(p, upgradable_packages_map[p.name]&.pluck(:nvra), installed_packages_map[p.name]&.first&.id) end end end end
Version data entries
16 entries across 16 versions & 1 rubygems