Bug 2129296

Summary: Incremental export of Content View broken by syncable export
Product: Red Hat Satellite Reporter: Radek Mynar <rmynar>
Component: Inter Satellite SyncAssignee: Partha Aji <paji>
Status: CLOSED ERRATA QA Contact: Sam Bible <sbible>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.12.0CC: ahumbe, paji, rlavi, sbible, vsedmik
Target Milestone: 6.15.0Keywords: Reopened, 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: 2024-04-23 17:12:42 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:

Description Radek Mynar 2022-09-23 08:55:56 UTC
Description of problem:
Performing a syncable complete export of Content View breaks continuity of importable incremental exports

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

How reproducible:
always

Steps to Reproduce:
1. Create an export organization (or use default) and add some content
2. Create a ContentView, publish new version and perform a complete version export
hammer content-export complete version --organization ExportOrg --content-view TestView --version 1.0
3. Publish new ContentView version and perform a complete syncable version export
hammer content-export complete version --organization ExportOrg --content-view TestView --version 2.0 --format syncable
4. Publish new ContentView version and perform an incremental version export
hammer content-export incremental version --organization ExportOrg --content-view TestView --version 3.0
5. Create an import organization
6. Copy exported content into pulp import directory (cp -R /var/lib/pulp/exports/ExportOrg/TestView /var/lib/pulp/imports/, chown -R pulp:pulp /var/lib/pulp/imports/TestView/)
7. Import complete ContentView version 1.0
hammer content-import version --organization "ImportOrg" --path /var/lib/pulp/imports/TestView/1.0/...
8. Attempt to import version 3.0
hammer content-import version --organization "ImportOrg" --path /var/lib/pulp/imports/TestView/3.0/...

Actual results:
  Could not import the archive.:
    Prior Content View Version specified in the metadata - 'TestView 2.0' does not exist. Please import the metadata for 'TestView 2.0' before importing 'TestView 3.0'

Expected results:
Version 3.0 is imported (just as if no export of 2.0 was done).
Performing a syncable export should not break continuity of importable incremental exports.

Additional info:
Similar issue with repository and library export was resolved in bz 2118431

Comment 1 Brad Buckingham 2023-10-30 11:29:29 UTC
Bulk setting Target Milestone = 6.15.0 where sat-6.15.0+ is set.

Comment 2 Partha Aji 2023-11-14 22:42:54 UTC
This is working as designed. 
The user does
hammer content-export complete version --organization ExportOrg --content-view TestView --version 1.0
hammer content-export complete version --organization ExportOrg --content-view TestView --version 2.0 --format=syncable
hammer content-export incremental version --organization ExportOrg --content-view TestView --version 3.0

and then in the import sat does

hammer content-import version --organization ImportOrg --path=/var/lib/pulp/<..>/1.0
hammer content-import version --organization ImportOrg --path=/var/lib/pulp/<..>/3.0

The error reported by the incremental export makes sense. 
You have to import version 2.0 before importing version 3.0 because the incremental export was between version 2.0 and 3.0. .

Comment 3 Radek Mynar 2023-11-15 13:26:21 UTC
I tried to do similar export/import process as described in steps to reproduce. The only difference was that I skipped the syncable export. Here's the list of commands:

hammer organization create --name "ExportOrg"
hammer product create --name "TestProd" --organization "ExportOrg"
hammer repository create --content-type yum --product "TestProd" --name "TestYumRepo0" --url "<yum_repo_url0>" --organization "ExportOrg"
hammer repository create --content-type yum --product "TestProd" --name "TestYumRepo1" --url "<yum_repo_url1>" --organization "ExportOrg"
hammer repository create --content-type yum --product "TestProd" --name "TestYumRepo2" --url "<yum_repo_url2>" --organization "ExportOrg"
hammer repository synchronize --product "TestProd" --name "TestYumRepo0" --organization "ExportOrg"
hammer repository synchronize --product "TestProd" --name "TestYumRepo1" --organization "ExportOrg"
hammer repository synchronize --product "TestProd" --name "TestYumRepo2" --organization "ExportOrg"
hammer content-view create --name "TestView" --organization "ExportOrg"
hammer content-view add-repository --repository "TestYumRepo0" --product "TestProd" --name "TestView" --organization "ExportOrg"
hammer content-view publish --name "TestView" --organization "ExportOrg"
hammer content-export complete version --content-view "TestView" --version "1.0" --organization "ExportOrg"
hammer content-view add-repository --repository "TestYumRepo1" --product "TestProd" --name "TestView" --organization "ExportOrg"
hammer content-view publish --name "TestView" --organization "ExportOrg"
# don't perform the syncable export here
hammer content-view add-repository --repository "TestYumRepo2" --product "TestProd" --name "TestView" --organization "ExportOrg"
hammer content-view publish --name "TestView" --organization "ExportOrg"
hammer content-export incremental version --content-view "TestView" --version "3.0" --organization "ExportOrg"
cp -R /var/lib/pulp/exports/ExportOrg/TestView /var/lib/pulp/imports/
chown -R pulp:pulp /var/lib/pulp/imports/TestView/
hammer organization create --name "ImportOrg"
ls -lha /var/lib/pulp/imports/TestView/
hammer content-import version --organization "ImportOrg" --path /var/lib/pulp/imports/TestView/1.0/<timestamp>/
hammer content-import version --organization "ImportOrg" --path /var/lib/pulp/imports/TestView/3.0/<timestamp>/

No error appears during import. As a result ImportOrg contains content view "TestView" with 2 versions - "1.0" and "3.0". 

Please consider reopening.

Comment 4 Partha Aji 2023-11-15 15:35:15 UTC
Hmm ok the CV versions in the  import org  will match the CV versions from export. So the behavior you see there is correct because
1) You did a Complete export of version 1.0
2) You then did an incremental export from version 1.0 -> 3.0
3) Then you imported version 1.0
4) Finally imported version 3.0 incrementally
5) As long as the contents of version 3 match we should be good.

Can you please reverify and reopen if I am missing something ?

Comment 5 Sam Bible 2024-01-23 15:58:09 UTC
Verified on 6.15 - Snap 5

Steps to Verify:
1. Following Radek's command list above you:
  - Create a CV, add a repo and publish
  - Do a complete Export
  - Add another repo and publish 2.0 
  - Add another repo and publish 3.0
  - Export incrementally version 3.0
  - Import both into a new Org

Expected Results:
Version 1.0 and 3.0 have the appropriate repos, and import correctly.

Actual Results:
Version 1.0 and 3.0 have the appropriate repos, and import correctly.

Comment 8 errata-xmlrpc 2024-04-23 17:12:42 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 (Important: Satellite 6.15.0 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-2024:2010