Project

Profile

Help

Issue #379

closed

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 about 9 years ago. Updated almost 4 years 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 +

Actions #1

Updated by cduryee about 9 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 +

Actions #2

Updated by cduryee about 9 years ago

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

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

Actions #3

Updated by cduryee about 9 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 +

Actions #4

Updated by amacdona@redhat.com about 9 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 +

Actions #5

Updated by amacdona@redhat.com about 9 years ago

  • Platform Release deleted (3.0.0)
Actions #6

Updated by bmbouter almost 9 years ago

  • Severity changed from Medium to 2. Medium
Actions #7

Updated by matthias.b about 5 years 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/

Actions #8

Updated by bmbouter almost 5 years ago

  • Status changed from NEW to CLOSED - WONTFIX
Actions #9

Updated by bmbouter almost 5 years 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.

Actions #10

Updated by bmbouter almost 5 years ago

  • Tags Pulp 2 added
Actions #11

Updated by bmbouter almost 4 years ago

  • Category deleted (14)

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

Also available in: Atom PDF