Bug 1663340

Summary: [RFE] allow recreation of content views when importing
Product: Red Hat Satellite Reporter: Chris Duryee <cduryee>
Component: Inter Satellite SyncAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Lai <ltran>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.5.0CC: bkearney, chrobert, ehelms, fgarciad, jentrena, jturel, jyejare, ltran, mmccune
Target Milestone: 6.10.0Keywords: FutureFeature, Triaged
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: Environment:
Last Closed: 2021-11-16 14:08:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1644596    

Description Chris Duryee 2019-01-03 22:41:12 UTC
Description of problem:

Content view import/export currently will create a content view version, but not a CV. However, the info needed to recreate the CV (name + list of repos) is already in the exported data.

This RFE is to recreate the content view if it doesn't already exist, then create the CV version. Note that this needs to work for both composite and regular CVs.

Comment 4 Bryan Kearney 2019-01-07 21:10:04 UTC
Upstream bug assigned to cduryee

Comment 6 Bryan Kearney 2019-01-29 23:02:08 UTC
Upstream bug assigned to cduryee

Comment 7 Mike McCune 2019-04-04 04:21:04 UTC
This RFE should also cover the use case of importing and exporting just the Content View definitions themselves and not all the actual repository content.

If we feel this goes beyond the scope of this RFE we can spawn out another BZ but for now lets cover both use cases here.

Comment 8 Bryan Kearney 2019-04-15 22:00:47 UTC
Upstream bug assigned to chrobert

Comment 10 Bryan Kearney 2020-07-29 20:04:59 UTC
Upstream bug assigned to chrobert

Comment 13 Mike McCune 2021-03-11 18:51:10 UTC
Upon review of our valid but aging backlog the Satellite Team has concluded that this Bugzilla does not meet the criteria for a resolution in the near term, and are planning to close in one month's time. If you have any concerns about this, please contact your Red Hat Account team.  Thank you.

Comment 15 Lai 2021-06-22 17:43:32 UTC
Info: The primary cv export/import has already been verified via https://bugzilla.redhat.com/show_bug.cgi?id=1884212.  The only portion missing is verifying the composite import.  Please not that COMPOSITES CANNOT BE IMPORTED.  Instead, the composite cv will be converted to a regular content view, preserving the name and version, and will include all of the contents that was once under the composite.
Step 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 a several RH repos
5. Sync the repos
6. Create 2 cv and split up adding the repos from step 4 to the 2 cv
7. Create a composite content view and add the 2 cv from step 6
8. Publish the composite content view twice to get it to version 2.0
9. Run the export command: hammer content-export complete version --id <cv-id> --organization-id <org-id>
10. Verify that the export files are created in "/var/lib/pulp/exports/<organization name>/<cv name><export time stamp>

#Import Disconnected Satellite Portion

11. On the satellite to import the cv, import manifest that would have all the repos created in step 4
12. Set "Default Red Hat Repository download policy" to "immediate" just like step 3.
13. Set "Disconnected Mode" to "Yes" by going to Administer -> Setting -> Content Tab -> Disconnected Mode
14. SCP the files from the exported directory in step 8 to /var/lib/pulp/imports in the satellite in which you want to import
15. Provide write permission to the dir imported: chown -R pulp:pulp /var/lib/pulp/imports/<dir with import>
16. Verify that the files are present in /var/lib/pulp/imports/<dir with import>
17. Run the import command: hammer content-import version --organization-id 1 --path /var/lib/pulp/imports/<dir with import>
18. Verify that on the UI that the composite imported is turned into a content view with the correct version number.

Expected result:
9. Export should be successful
10. There should be 3 files created: export-<id>.tar.gz, export-<id>-toc.json, and metadata.json
16. There should be 3 files: export-<id>.tar.gz, export-<id>-toc.json, and metadata.json
17. Import should be successful
18. UI should show the name of the composite cv, but should now be a content view with all the contents from the composite imported over

Actual result:
9. Export is successful:
# hammer content-export complete version --id 2 --organization-id 1
[......................................................................................................................................] [100%]
Generated /var/lib/pulp/exports/Default_Organization/lai_composite/3.0/2021-06-22T09-27-52-04-00/metadata.json

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

18. UI shows the composite name turned into a content view with all the contents present.

Verified on 6.10_05

Comment 18 errata-xmlrpc 2021-11-16 14:08: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