Skip to content

Commit aa04975

Browse files
sbernhardm-bucher
authored andcommitted
Show which Deb packages were added to incremental CV version
1 parent 3a4e894 commit aa04975

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

app/lib/actions/katello/content_view/incremental_updates.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def total_counts(input)
8181
if added_units
8282
total_count[:errata_count] = added_units[:erratum].try(:count)
8383
total_count[:rpm_count] = added_units[:rpm].try(:count)
84+
total_count[:deb_count] = added_units[:deb].try(:count)
8485
total_count[:puppet_module_count] = added_units[:puppet_module].try(:count)
8586
end
8687
end
@@ -121,6 +122,10 @@ def content_output_collection(total_count)
121122
rpm = _(" %{package_count} Package(s)" % {:package_count => total_count[:rpm_count]})
122123
content << rpm
123124
end
125+
if total_count[:deb_count] && total_count[:deb_count] > 0
126+
deb = _(" %{deb_package_count} Package(s)" % {:deb_package_count => total_count[:deb_count]})
127+
content << deb
128+
end
124129
if total_count[:puppet_module_count] && total_count[:puppet_module_count] > 0
125130
puppet_module = _(" %{puppet_module_count} Puppet Module(s)" %
126131
{:puppet_module_count => total_count[:puppet_module_count]})

app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ module Presenters
55
class IncrementalUpdatesPresenter < Helpers::Presenter::Base
66
HUMANIZED_TYPES = {
77
::Katello::Erratum::CONTENT_TYPE => "Errata",
8-
::Katello::Rpm::CONTENT_TYPE => "Packages",
8+
::Katello::Rpm::CONTENT_TYPE => "RPM Packages",
9+
::Katello::Deb::CONTENT_TYPE => "Deb Packages",
910
::Katello::PuppetModule::CONTENT_TYPE => "Puppet Modules"
1011
}.freeze
1112

@@ -25,7 +26,7 @@ def humanized_content
2526
if cvv
2627
humanized_lines << "Content View: #{cvv.content_view.name} version #{cvv.version}"
2728
humanized_lines << _("Added Content:")
28-
[::Katello::Erratum, ::Katello::Rpm, ::Katello::PuppetModule].each do |content_type|
29+
[::Katello::Erratum, ::Katello::Rpm, ::Katello::Deb, ::Katello::PuppetModule].each do |content_type|
2930
unless output[:added_units][content_type::CONTENT_TYPE].blank?
3031
humanized_lines << " #{HUMANIZED_TYPES[content_type::CONTENT_TYPE]}:"
3132
humanized_lines += output[:added_units][content_type::CONTENT_TYPE].sort.map { |unit| " #{unit}" }

app/lib/actions/katello/content_view_version/incremental_update.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def calculate_components(old_version, new_components)
166166

167167
def generate_description(version, content)
168168
humanized_lines = []
169-
[::Katello::Erratum, ::Katello::Rpm, ::Katello::PuppetModule].each do |content_type|
169+
[::Katello::Erratum, ::Katello::Rpm, ::Katello::Deb, ::Katello::PuppetModule].each do |content_type|
170170
unless content[content_type::CONTENT_TYPE].blank?
171171
humanized_lines << "#{HUMANIZED_TYPES[content_type::CONTENT_TYPE]}:"
172172
humanized_lines += content[content_type::CONTENT_TYPE].sort.map { |unit| " #{unit}" }
@@ -220,10 +220,10 @@ def copy_deb_content(new_repo, dep_solve, deb_ids, erratum_ids)
220220
copy_outputs = []
221221
if new_repo.content_type == ::Katello::Repository::DEB_TYPE
222222
unless erratum_ids.blank?
223-
plan_action(Katello::Repository::CopyDebErratum,
224-
source_repo_id: new_repo.library_instance.id,
225-
target_repo_id: new_repo.id,
226-
erratum_ids: erratum_ids)
223+
copy_outputs << plan_action(Katello::Repository::CopyDebErratum,
224+
source_repo_id: new_repo.library_instance.id,
225+
target_repo_id: new_repo.id,
226+
erratum_ids: erratum_ids).output
227227
end
228228

229229
unless deb_ids.blank?

app/lib/actions/katello/repository/copy_deb_erratum.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ def run
1818
erratum_ids_to_copy -= target_repo.erratum_ids
1919
target_repo.erratum_ids |= erratum_ids_to_copy
2020
target_repo.save
21-
output = erratum_ids_to_copy
21+
22+
# fake output to make foreman task presenter happy
23+
if erratum_ids
24+
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 }}} }}]
25+
end
2226
end
2327
end
2428
end

0 commit comments

Comments
 (0)