Bug 1971686

Summary: Failed to import content view with more than 20 repositories enabled
Product: Red Hat Satellite Reporter: James Jeffers <jjeffers>
Component: Inter Satellite SyncAssignee: Chris Roberts <chrobert>
Status: CLOSED NEXTRELEASE QA Contact: Lai <ltran>
Severity: high Docs Contact:
Priority: high    
Version: 6.7.0CC: ahumbe, chrobert, jjeffers, rbertolj
Target Milestone: UnspecifiedKeywords: PrioBumpGSS
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1884212 Environment:
Last Closed: 2021-10-04 12:19:03 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description James Jeffers 2021-06-14 14:55:26 UTC
+++ This bug was initially created as a clone of Bug #1884212 +++

Description of problem:

Importing a content view with more than 20 repositories enabled (more than set in the  pagination setting) fails.

Most likely a regression introduced by https://github.com/Katello/hammer-cli-katello/commit/9bf7858adcf30410ae81ab9d430fd727eeb881bd

This bugzilla (https://bugzilla.redhat.com/show_bug.cgi?id=1722713) was fixed by https://github.com/Katello/hammer-cli-katello/pull/696/commits/58b7ecb75023c5913b6a65ef86976db12c83f089 

===
From 58b7ecb75023c5913b6a65ef86976db12c83f089 Mon Sep 17 00:00:00 2001
From: Chris Roberts <chrobert>
Date: Mon, 9 Sep 2019 15:52:13 +0000
Subject: [PATCH] Fixes #27807 - Prevent timeout during CVV import

---
 lib/hammer_cli_katello/content_view_version.rb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/hammer_cli_katello/content_view_version.rb b/lib/hammer_cli_katello/content_view_version.rb
index 0fa823bd..e69be408 100644
--- a/lib/hammer_cli_katello/content_view_version.rb
+++ b/lib/hammer_cli_katello/content_view_version.rb
@@ -498,7 +498,8 @@ def sync_repositories(repositories, organization_id, options)
           library_repos = index(
             :repositories,
             'organization_id' => organization_id,
-            'library' => true
+            'library' => true,
+            'label' => repo['label']
           )
 
           library_repo = library_repos.select do |candidate_repo|
===

Due to refactoring made in https://github.com/Katello/hammer-cli-katello/commit/9bf7858adcf30410ae81ab9d430fd727eeb881bd the change was basically reverted back to its original state.

From 9bf7858adcf30410ae81ab9d430fd727eeb881bd Mon Sep 17 00:00:00 2001
From: Chris Roberts <chrobert>
Date: Wed, 11 Sep 2019 19:06:17 +0000
Subject: [PATCH] Fixes #27838 - Refactor cvv export to allow for default cv

---
 .../content_view_version.rb                   |  21 +-
 .../cv_import_export_helper.rb                |  80 ++++---
 .../content_view/version/export_test.rb       | 197 +-----------------
 3 files changed, 52 insertions(+), 246 deletions(-)

diff --git a/lib/hammer_cli_katello/content_view_version.rb b/lib/hammer_cli_katello/content_view_version.rb
index e69be408..7564892a 100644
--- a/lib/hammer_cli_katello/content_view_version.rb
+++ b/lib/hammer_cli_katello/content_view_version.rb
...
@@ -498,8 +498,7 @@ def sync_repositories(repositories, organization_id, options)
           library_repos = index(
             :repositories,
             'organization_id' => organization_id,
-            'library' => true,
-            'label' => repo['label']
+            'library' => true
           )
...
===

Actual results:

===
[DEBUG 2020-09-28T20:29:26 Exception] Using exception handler HammerCLIKatello::ExceptionHandler#handle_general_exception
[ERROR 2020-09-28T20:29:26 Exception] Error: Unable to sync repositories, no library repository found for Red_Hat_Satellite_Capsule_6_3_-_Puppet_4_for_RHEL_7_Server_RPMs_x86_64
Could not import the content view:
  Error: Unable to sync repositories, no library repository found for Red_Hat_Satellite_Capsule_6_3_-_Puppet_4_for_RHEL_7_Server_RPMs_x86_64
[ERROR 2020-09-28T20:29:26 Exception]
 
RuntimeError (Unable to sync repositories, no library repository found for Red_Hat_Satellite_Capsule_6_3_-_Puppet_4_for_RHEL_7_Server_RPMs_x86_64):
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.20.2.3/lib/hammer_cli_katello/content_view_version.rb:512:in `block in sync_repositories'
   /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.20.2.3/lib/hammer_cli_katello/content_view_version.rb:497:in `each'
   /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.20.2.3/lib/hammer_cli_katello/content_view_version.rb:497:in `sync_repositories'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.20.2.3/lib/hammer_cli_katello/content_view_version.rb:479:in `execute'
   /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
   /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.19.2.1/lib/hammer_cli/abstract.rb:76:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
   /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
   /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.19.2.1/lib/hammer_cli/abstract.rb:76:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
   /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
   /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.19.2.1/lib/hammer_cli/abstract.rb:76:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
   /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
   /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.19.2.1/lib/hammer_cli/abstract.rb:76:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:132:in `run'
   /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.19.2.1/bin/hammer:147:in `<top (required)>'
   /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'
===

Expected results:
Succesfull import.

--- Additional comment from  on 2021-06-11T18:16:19Z 

*** Bug 1946348 has been marked as a duplicate of this bug. ***

Comment 2 James Jeffers 2021-06-14 14:56:43 UTC
This clone is just to track the fix in 6.9.z.

Comment 5 Brad Buckingham 2021-10-04 12:19:03 UTC
This issue should be resolved in Satellite 6.10, which currently has a public beta available.

Satellite 6.10 includes the new Pulp 3 backend service.  As part of upgrading to it, several enhancements were made to the content export/import capabilities.