Bug 1884212 - Failed to import content view with more than 20 repositories enabled
Summary: Failed to import content view with more than 20 repositories enabled
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Inter Satellite Sync
Version: 6.7.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: 6.10.0
Assignee: Chris Roberts
QA Contact: Lai
URL: https://projects.theforeman.org/issue...
Whiteboard:
: 1946348 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-10-01 11:20 UTC by Alexey Masolov
Modified: 2022-08-09 03:19 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1971686 (view as bug list)
Environment:
Last Closed: 2021-11-16 14:09:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 32129 0 Normal Assigned Failed to import content view with more than 20 repositories enabled 2021-03-18 21:30:49 UTC
Github Katello hammer-cli-katello pull 796 0 None open Fixes #32129 - Fix legacy import when importing 20+ repos 2021-03-24 15:21:02 UTC
Red Hat Product Errata RHSA-2021:4702 0 None None None 2021-11-16 14:09:35 UTC

Description Alexey Masolov 2020-10-01 11:20:56 UTC
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.

Comment 1 Chris Roberts 2021-06-11 18:16:19 UTC
*** Bug 1946348 has been marked as a duplicate of this bug. ***

Comment 2 Chris Roberts 2021-06-15 15:19:18 UTC
Satellite 6.10 will be only Pulp3, which means that this BZ can only go back to Satellite 6.9.Z

The commands to export/import with this method have been removed in 6.10 and the new method to export/import is

https://docs.theforeman.org/2.4/Content_Management_Guide/index-katello.html#Using_ISS

Setting the target milestone to 6.9.4

Comment 3 James Jeffers 2021-06-15 15:41:01 UTC
Chris,

There is already a clone of this for 6.9.z. https://bugzilla.redhat.com/show_bug.cgi?id=1971686


BBuckinghanm requested this for 6.10 to check for any regressions.  Brad, can you clarify/confirm?

Comment 4 Brad Buckingham 2021-06-15 15:51:47 UTC
Chris, 

This bugzilla is intended for 6.10 verification.  While it is true that the commands in 6.10 are different, we need to ensure that the new implementation/commands/workflow with pulp 3 allows a user to import content views with more than 20 repositories.

As James mentioned, this bugzilla was also cloned to 6.9.z, since the implementation there is different.

Thanks!

Comment 6 Lai 2021-06-17 16:03:31 UTC
Steps to retest:

1. Spin up 2 Satellites (6.10 each)

#Export Satellite Portion

2. On satellite to export, import manifest
3. Administer -> Setting -> Search for "Default Red Hat Repository download policy" -> Set policy to "immediate"
4. Enable 21 repos (I used an export.sh script in the PR for this)
5. Sync the repos
6. Create a cv, add all the repos enabled in step 4 and publish cv
7. Run the export command: hammer content-export complete version --id <cv-id> --organization-id <org-id>
8. Verify that the export files are created in "/var/lib/pulp/exports/<organization name>/<cv name><export time stamp>

#Import Satellite Portion

9. On the satellite to import the cv, import manifest that would have all the repos created in step 4
10. Set "Default Red Hat Repository download policy" to "immediate" just like step 3.
11. SCP the files from the exported directory in step 8 to /var/lib/pulp/imports in the satellite in which you want to import (scp just the three files over: tar.gz, metadata.json, and toc.json)
12. Verify that the files are present in /var/lib/pulp/imports
13. Run the import command: hammer conent-import version --organization-id 1 --path /var/lib/pulp/imports
14. Verify that on the UI that the cv is imported with all 21 repos.

Expected result:
7. Export should be successful
8. There should be 3 files created: export-<id>.tar.gz, export-<id>-toc.json, and metadata.json
12. There should be 3 files: export-<id>.tar.gz, export-<id>-toc.json, and metadata.json
13. Import should be successful
14. UI should show the cv with all 21 repos present

Actual result:
7. Export is successful:
# hammer content-export complete version --id 2 --organization-id 1
[......................................................................................................................................] [100%]
Generated /var/lib/pulp/exports/Default_Organization/my_cv_export_import/1.0/2021-06-17T11-04-39-04-00/metadata.json

8. There are 3 files created: export-<id>.tar.gz, export-<id>-toc.json, and metadata.json
12. There are 3 files: export-<id>.tar.gz, export-<id>-toc.json, and metadata.json
13. Import is successful:
# hammer content-import version --organization-id 1 --path /var/lib/pulp/imports/
[......................................................................................................................................] [100%]

14. UI shows the cv with all 21 repos present

Verified on 6.10_04

Comment 9 errata-xmlrpc 2021-11-16 14:09:27 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: Satellite 6.10 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:4702


Note You need to log in before you can comment on or make changes to this bug.