Project

Profile

Help

Issue #379

No error when criteria inside request body lack the required type_ids (when unassociating this results in an empty repository)

Added by vincent.vandriessche@inuits.eu over 5 years ago. Updated 4 months ago.

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

Description

Description of problem:
While making a script to remove a set of packages, I encountered a stubborn error: When performing a POST request to "/pulp/api/v2/repositories/pulp2-cleanup-test/actions/unassociate/" with message body resembling following json:
{'criteria':
{'filters':
{'unit':
{'unit_id':
{'$in':
['5b1feecc-5b48-40a6-a890-39f0bf5b3960']
}
}
}
}
}
I ran into the fact that it did not remove the package with ID 5b1feecc-5b48-40a6-a890-39f0bf5b3960; It removed ALL of the repositories packages.

After some talking to the developers I was pointed out that without a type_id specified, the filters would all be dropped, what remains was an unassociate query without filtering: resulting in every package being removed.

This is how the packages are not all being dropped any longer:
{"criteria":
{"filters":
{"unit":
{"unit_id":
{"$in":
['5b1feecc-5b48-40a6-a890-39f0bf5b3960']
}
}
},
"type_ids":["rpm"]
}
}

I do think this should be properly documented or/and should throw an error instead of just wiping out repositories. ^^

Kind regards

Vincent

+ This bug was cloned from Bugzilla Bug #1021579 +

History

#1 Updated by cduryee over 5 years ago

I would consider this to be an API bug, it is unexpected that all of the units are unassociated. I will document it for now but it should be fixed for Pulp 3.0.

+ This comment was cloned from Bugzilla #1021579 comment 1 +

#2 Updated by cduryee over 5 years ago

doc update: https://github.com/pulp/pulp/pull/1327

+ This comment was cloned from Bugzilla #1021579 comment 2 +

#3 Updated by cduryee over 5 years ago

docs update is merged to 2.4-release and up, changing BZ component to API/integration for the actual fix

+ This comment was cloned from Bugzilla #1021579 comment 3 +

#4 Updated by amacdona@redhat.com over 5 years ago

This is the case for more than just this call. Many API calls that use critera to filter results have a similar issue.

+ This comment was cloned from Bugzilla #1021579 comment 4 +

#5 Updated by amacdona@redhat.com over 5 years ago

  • Platform Release deleted (3.0.0)

#6 Updated by bmbouter over 5 years ago

  • Severity changed from Medium to 2. Medium

#7 Updated by matthias.b over 1 year ago

Version
Pulp 2.18

Description
I found that this issue is also present with "deb" type id :

{
    "filters": {
        "unit" : {
                "unit_id": "e5c53490-391b-43a1-8c23-37c44ea1d5df"
            }
        },
    "type_ids": ["deb"]
}

nor

{
    "filters": {
        "unit" : {
                "unit_id": {"$in": ["e5c53490-391b-43a1-8c23-37c44ea1d5df"]}
            }
        },
    "type_ids": ["deb"]
}

don't workaround the issue. All packages on my repo are dropped when POSTing on /pulp/api/v2/repositories/my_repo/actions/unassociate/

#8 Updated by bmbouter over 1 year ago

  • Status changed from NEW to CLOSED - WONTFIX

#9 Updated by bmbouter over 1 year ago

Pulp 2 is approaching maintenance mode, and this Pulp 2 ticket is not being actively worked on. As such, it is being closed as WONTFIX. Pulp 2 is still accepting contributions though, so if you want to contribute a fix for this ticket, please reopen or comment on it. If you don't have permissions to reopen this ticket, or you want to discuss an issue, please reach out via the developer mailing list.

#10 Updated by bmbouter over 1 year ago

  • Tags Pulp 2 added

#11 Updated by bmbouter 4 months ago

  • Category deleted (14)

We are removing the 'API' category per open floor discussion June 16, 2020.

Please register to edit this issue

Also available in: Atom PDF