Project

General

Profile

Actions

Bug #36920

closed

katello:reimport fails with "TypeError: no implicit conversion of String into Integer" when there are product contents to move

Added by Samir Jha 7 months ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Hosts
Target version:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=2225534

Description of problem:

foreman-rake katello:reimport would fail while importing "Katello::Content" and the failure is only observed when there are product contents to move and https://github.com/Katello/katello/blob/KATELLO-4.8/app/services/katello/product_content_importer.rb#L37-L44 code is triggered.

Version-Release number of selected component (if applicable):

Satellite 6.13.1

How reproducible:

Only on Customer's environment

Steps to Reproduce:
NA

Actual results:

  1. foreman-rake katello:reimport --trace
  • Invoke katello:reimport (first_time)
  • Invoke dynflow:client (first_time)
  • Invoke environment (first_time)
  • Execute environment
  • Execute dynflow:client
  • Invoke katello:check_ping (first_time)
  • Invoke environment
  • Invoke dynflow:client
  • Execute katello:check_ping
  • Execute katello:reimport
    Importing Katello::Subscription
    Importing Katello::Pool
    Importing Katello::Content
    rake aborted!
    TypeError: no implicit conversion of String into Integer
    /usr/share/gems/gems/katello-4.7.0.25/app/services/katello/product_content_importer.rb:39:in `[]'
    /usr/share/gems/gems/katello-4.7.0.25/app/services/katello/product_content_importer.rb:39:in `block in find_product_for_content'
    /usr/share/gems/gems/katello-4.7.0.25/app/services/katello/product_content_importer.rb:38:in `each'
    /usr/share/gems/gems/katello-4.7.0.25/app/services/katello/product_content_importer.rb:38:in `find'
    /usr/share/gems/gems/katello-4.7.0.25/app/services/katello/product_content_importer.rb:38:in `find_product_for_content'
    /usr/share/gems/gems/katello-4.7.0.25/app/services/katello/product_content_importer.rb:66:in `block in handle_product_moves'
    /usr/share/gems/gems/katello-4.7.0.25/app/services/katello/product_content_importer.rb:63:in `each'
    /usr/share/gems/gems/katello-4.7.0.25/app/services/katello/product_content_importer.rb:63:in `handle_product_moves'
    /usr/share/gems/gems/katello-4.7.0.25/app/services/katello/product_content_importer.rb:84:in `block in import'
    /usr/share/gems/gems/katello-4.7.0.25/app/services/katello/product_content_importer.rb:83:in `each'
    /usr/share/gems/gems/katello-4.7.0.25/app/services/katello/product_content_importer.rb:83:in `import'
    /usr/share/gems/gems/katello-4.7.0.25/app/models/katello/content.rb:55:in `block in import_all'

Expected results:

No such errors

Additional info:

For this specific user, following change fixed the issue:

diff --git a/app/services/katello/product_content_importer.rb b/app/services/katello/product_content_importer.rb
index b5e345e..6757768 100644
--- a/app/services/katello/product_content_importer.rb
+++ b/app/services/katello/product_content_importer.rb
@ -36,7 +36,7 @ module Katello

def find_product_for_content(content_id)
prod = @cp_products.find do |prod_json|
- prod_json['productContent'].any? do |product_content_json|
+ prod_json.first&.[]('productContent')&.any? do |product_content_json|
product_content_json["content"]["id"] == content_id
end
end

See next comments for more information.

Actions #1

Updated by The Foreman Bot 7 months ago

  • Status changed from New to Ready For Testing
  • Assignee set to Samir Jha
  • Pull request https://github.com/Katello/katello/pull/10798 added
Actions #2

Updated by Quinn James 7 months ago

  • Subject changed from katello:reimport fails with "TypeError: no implicit conversion of String into Integer" when there are product contents to move to katello:reimport fails with "TypeError: no implicit conversion of String into Integer" when there are product contents to move
  • Target version set to Katello 4.11.0
  • Triaged changed from No to Yes
Actions #3

Updated by The Foreman Bot 7 months ago

  • Fixed in Releases Katello 4.11.0 added
Actions #4

Updated by Samir Jha 7 months ago

  • Status changed from Ready For Testing to Closed
Actions #5

Updated by The Foreman Bot 7 months ago

  • Pull request https://github.com/Katello/katello/pull/10822 added
Actions

Also available in: Atom PDF