Project

Profile

Help

Issue #8798

closed

Content summary shows incorrect numbers when previous version is deleted

Added by daviddavis over 3 years ago. Updated almost 3 years ago.

Status:
CLOSED - DUPLICATE
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

Ticket moved to GitHub: "pulp/pulpcore/2084":https://github.com/pulp/pulpcore/issues/2084


Not sure if this is a bug or intentional but I noticed while working on #8793.

If you create two repo versions (version 1 and 2) and add a content item to each, and then delete version 1, the "added" count will show a count of 1 even though compared to version 0, version 2 has 2 items added:

  "content_summary": {                                                                                                                                                                        
    "added": {                                                                                                                                                                                
      "file.file": {                                                                                                                                                                          
        "count": 1,                                                                                                                                                                           
        "href": "/pulp/api/v3/content/file/files/?repository_version_added=/pulp/api/v3/repositories/file/file/f53f39d7-341d-4c4c-8835-1fcddb359791/versions/2/"                              
      }                                                                                                                                                                                       
    },                                                                                                                                                                                        
    "removed": {},                                                                                                                                                                            
    "present": {                                                                                                                                                                              
      "file.file": {                                                                                                                                                                          
        "count": 2,                                                                                                                                                                           
        "href": "/pulp/api/v3/content/file/files/?repository_version=/pulp/api/v3/repositories/file/file/f53f39d7-341d-4c4c-8835-1fcddb359791/versions/2/"                                    
      }                                                                                                                                                                                       
    }                                                                                                                                                                                         

Also, when you query the content through the href provided by the content summary, you get back 2 units which doesn't seem to match the count provided:

$ http :/pulp/api/v3/content/file/files/?repository_version_added=/pulp/api/v3/repositories/file/file/f53f39d7-341d-4c4c-8835-1fcddb359791/versions/2/                                          
{                                                                                                                                                                                             
    "count": 2,                                                                                                                                                                               
    "next": null,                                                                                                                                                                             
    "previous": null,                                                                                                                                                                         
    "results": [...]
}

Steps to reproduce

pulp file repository create --name test1 --remote file
pulp file repository sync --name test1
c1=$(pulp file content list | jq -r ".[0] | with_entries(select([.key] | inside([\"sha256\", \"relative_path\"])))")
c2=$(pulp file content list | jq -r ".[1] | with_entries(select([.key] | inside([\"sha256\", \"relative_path\"])))")

pulp file repository create --name test2
pulp file repository content modify --repository test2 --add-content "[$c1]"
pulp file repository content modify --repository test2 --add-content "[$c2]"

pulp file repository version destroy --repository test2 --version 1
pulp file repository version show --repository test2 --version 2

# then query the content added
http :/pulp/api/v3/content/file/files/?repository_version_added=/pulp/api/v3/repositories/file/file/f53f39d7-341d-4c4c-8835-1fcddb359791/versions/2/

Also available in: Atom PDF