Skip to content

Commit

Permalink
Show which Deb packages were added to incremental CV version
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernhard authored and m-bucher committed Feb 4, 2019
1 parent 403dddd commit 9333543
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
5 changes: 5 additions & 0 deletions app/lib/actions/katello/content_view/incremental_updates.rb
Expand Up @@ -81,6 +81,7 @@ def total_counts(input)
if added_units
total_count[:errata_count] = added_units[:erratum].try(:count)
total_count[:rpm_count] = added_units[:rpm].try(:count)
total_count[:deb_count] = added_units[:deb].try(:count)
total_count[:puppet_module_count] = added_units[:puppet_module].try(:count)
end
end
Expand Down Expand Up @@ -121,6 +122,10 @@ def content_output_collection(total_count)
rpm = _(" %{package_count} Package(s)" % {:package_count => total_count[:rpm_count]})
content << rpm
end
if total_count[:deb_count] && total_count[:deb_count] > 0
deb = _(" %{deb_package_count} Package(s)" % {:deb_package_count => total_count[:deb_count]})
content << deb
end
if total_count[:puppet_module_count] && total_count[:puppet_module_count] > 0
puppet_module = _(" %{puppet_module_count} Puppet Module(s)" %
{:puppet_module_count => total_count[:puppet_module_count]})
Expand Down
Expand Up @@ -5,7 +5,8 @@ module Presenters
class IncrementalUpdatesPresenter < Helpers::Presenter::Base
HUMANIZED_TYPES = {
::Katello::Erratum::CONTENT_TYPE => "Errata",
::Katello::Rpm::CONTENT_TYPE => "Packages",
::Katello::Rpm::CONTENT_TYPE => "RPM Packages",
::Katello::Deb::CONTENT_TYPE => "Deb Packages",
::Katello::PuppetModule::CONTENT_TYPE => "Puppet Modules"
}.freeze

Expand All @@ -25,7 +26,7 @@ def humanized_content
if cvv
humanized_lines << "Content View: #{cvv.content_view.name} version #{cvv.version}"
humanized_lines << _("Added Content:")
[::Katello::Erratum, ::Katello::Rpm, ::Katello::PuppetModule].each do |content_type|
[::Katello::Erratum, ::Katello::Rpm, ::Katello::Deb, ::Katello::PuppetModule].each do |content_type|
unless output[:added_units][content_type::CONTENT_TYPE].blank?
humanized_lines << " #{HUMANIZED_TYPES[content_type::CONTENT_TYPE]}:"
humanized_lines += output[:added_units][content_type::CONTENT_TYPE].sort.map { |unit| " #{unit}" }
Expand Down
Expand Up @@ -165,7 +165,7 @@ def calculate_components(old_version, new_components)

def generate_description(version, content)
humanized_lines = []
[::Katello::Erratum, ::Katello::Rpm, ::Katello::PuppetModule].each do |content_type|
[::Katello::Erratum, ::Katello::Rpm, ::Katello::Deb, ::Katello::PuppetModule].each do |content_type|
unless content[content_type::CONTENT_TYPE].blank?
humanized_lines << "#{HUMANIZED_TYPES[content_type::CONTENT_TYPE]}:"
humanized_lines += content[content_type::CONTENT_TYPE].sort.map { |unit| " #{unit}" }
Expand Down Expand Up @@ -219,10 +219,10 @@ def copy_deb_content(new_repo, dep_solve, deb_ids, erratum_ids)
copy_outputs = []
if new_repo.content_type == ::Katello::Repository::DEB_TYPE
unless erratum_ids.blank?
plan_action(Katello::Repository::CopyDebErratum,
source_repo_id: new_repo.library_instance.id,
target_repo_id: new_repo.id,
erratum_ids: erratum_ids)
copy_outputs << plan_action(Katello::Repository::CopyDebErratum,
source_repo_id: new_repo.library_instance.id,
target_repo_id: new_repo.id,
erratum_ids: erratum_ids).output
end

unless deb_ids.blank?
Expand Down
6 changes: 5 additions & 1 deletion app/lib/actions/katello/repository/copy_deb_erratum.rb
Expand Up @@ -18,7 +18,11 @@ def run
erratum_ids_to_copy -= target_repo.erratum_ids
target_repo.erratum_ids |= erratum_ids_to_copy
target_repo.save
output = erratum_ids_to_copy

# fake output to make foreman task presenter happy
if erratum_ids
output[:pulp_tasks] = [{ :result => { :units_successful => ::Katello::Erratum.where(:id => erratum_ids_to_copy).pluck(:errata_id).map { |errata| { "type_id" => "erratum", "unit_key" => { id: errata }}} }}]
end
end
end
end
Expand Down

0 comments on commit 9333543

Please sign in to comment.