Issue #1533
closedpackage group/category unassociate not working
Description
1) Get the zoo5 repo from -> https://github.com/Katello/runcible/tree/master/test/fixtures/repositories/zoo5 (we just need the repo.) Steps below will assume file:///var/www/repositories/zoo5 is the destination
2)
$ pulp-admin rpm repo create --repo-id=ideate --feed=file:///var/www/repositories/zoo5
$ pulp-admin rpm repo sync run --repo-id=ideate
$ pulp-admin rpm repo content group --repo-id=ideate
Conditional Package Names:
Default Package Names:
Id: mammal
......
Conditional Package Names:
Default Package Names:
Id: bird
......
$ pulp-admin -vv rpm repo remove group --repo-id=ideate --in='id=mammal'
....
INFO - POST request to /pulp/api/v2/repositories/boo/actions/unassociate/ with parameters {"criteria": {"type_ids": ["package_group"], "filters": {"unit": {"id": {"$in": ["mammal"]}}}}}
....
Running...
Nothing found that matches the given criteria.
Related issues
Updated by paji@redhat.com almost 9 years ago
- Copied to Issue #1535: Errata unassociate not working added
Updated by paji@redhat.com almost 9 years ago
- Subject changed from package group unassociate not working to package group/category unassociate not working
Updated by mhrivnak almost 9 years ago
- Priority changed from Normal to High
- Severity changed from 2. Medium to 3. High
- Platform Release set to 2.8.0
- Triaged changed from No to Yes
Updated by mhrivnak almost 9 years ago
- Related to Issue #1527: package group/category/distribution search not working added
Updated by mhrivnak almost 9 years ago
- Related to Issue #1534: Errata search not working added
Updated by semyers almost 9 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to semyers
Provided the changes I proposed in https://github.com/pulp/pulp/pull/2341 get merged, this is probably a couple of lines of code to fix.
Added by semyers almost 9 years ago
Added by semyers almost 9 years ago
Revision 8d462ca8 | View on GitHub
unit association query uses model serializers
When building mongo queries, UnitAssociationQuery wasn't translating the incoming fields to their proper mongo fields via the model serializer.
To start, this change makes "public" the serializer translate methods that provide useful functionality when incoming criteria get broken down into their actual mongo queries.
Then, those public methods are used by UnitAssociationQuery to translate model fields before building queries to mongo.
https://pulp.plan.io/issues/1527 fixes #1527
https://pulp.plan.io/issues/1533 re #1533
Updated by semyers almost 9 years ago
After applying the fix from #1527, the group is correctly unassociated as expected, but pulp-admin still reports that nothing matched the criteria. I'm tracking that down now.
Updated by semyers almost 9 years ago
- Status changed from ASSIGNED to POST
Added by semyers almost 9 years ago
Revision 6c9751fa | View on GitHub
Use model serializers when searching mongoengine content units
When breaking a criteria down into its raw mongo queries, use the model serializers for a given content type to adjust the unit search spec as-needed for each content type in the criteria.
https://pulp.plan.io/issues/1479 fixes #1479
https://pulp.plan.io/issues/1533 fixes #1533
Added by semyers almost 9 years ago
Revision 6c9751fa | View on GitHub
Use model serializers when searching mongoengine content units
When breaking a criteria down into its raw mongo queries, use the model serializers for a given content type to adjust the unit search spec as-needed for each content type in the criteria.
https://pulp.plan.io/issues/1479 fixes #1479
https://pulp.plan.io/issues/1533 fixes #1533
Updated by semyers almost 9 years ago
- Status changed from POST to MODIFIED
- % Done changed from 0 to 100
Applied in changeset pulp|6c9751fa1378bae69b833b043fb1b68a355be34d.
Updated by dkliban@redhat.com almost 9 years ago
- Status changed from MODIFIED to 5
Updated by placko almost 9 years ago
- Status changed from 5 to 6
$ pulp-admin status
+----------------------------------------------------------------------+
Status of the server
+----------------------------------------------------------------------+
Api Version: 2
Database Connection:
Connected: True
Known Workers:
_id: scheduler@host.internal
_ns: workers
Last Heartbeat: 2016-03-03T10:34:24Z
_id: reserved_resource_worker-0@host.internal
_ns: workers
Last Heartbeat: 2016-03-03T10:34:56Z
_id: reserved_resource_worker-1@host.internal
_ns: workers
Last Heartbeat: 2016-03-03T10:34:58Z
_id: resource_manager@host.internal
_ns: workers
Last Heartbeat: 2016-03-03T10:34:58Z
Messaging Connection:
Connected: True
Versions:
Platform Version: 2.8.0b6
$ pulp-admin rpm repo create --repo-id=ideate --feed=file:///var/www/repositories/zoo5
Successfully created repository [ideate]
$ pulp-admin rpm repo sync run --repo-id=ideate
+----------------------------------------------------------------------+
Synchronizing Repository [ideate]
+----------------------------------------------------------------------+
===================================== Snip ====================================
===============================================================================
Task Succeeded
$ pulp-admin rpm repo content group --repo-id=ideate
Conditional Package Names:
Default Package Names:
Id: mammal
Mandatory Package Names: elephant,giraffe,cheetah,lion,monkey,penguin,squirrel
,walrus, penguin
Name: mammal
Optional Package Names:
User Visible: True
Conditional Package Names:
Default Package Names:
Id: bird
Mandatory Package Names: penguin
Name: bird
Optional Package Names:
User Visible: True
[root@ip-10-15-2-47 ~]# pulp-admin -vv rpm repo remove group --repo-id=ideate --in='id=mammal'
2016-03-03 07:23:36,966 - DEBUG - sending POST request to /pulp/api/v2/repositories/ideate/actions/unassociate/
2016-03-03 07:23:37,059 - INFO - POST request to /pulp/api/v2/repositories/ideate/actions/unassociate/ with parameters {"criteria": {"type_ids": ["package_group"], "filters": {"unit": {"id": {"$in": ["mammal"]}}}}}
2016-03-03 07:23:37,059 - INFO - Response status : 202
2016-03-03 07:23:37,060 - INFO - Response body :
{
"spawned_tasks": [
{
"_href": "/pulp/api/v2/tasks/c06bfa97-95b0-40ca-b9f1-02aea3d0e55a/",
"task_id": "c06bfa97-95b0-40ca-b9f1-02aea3d0e55a"
}
],
"result": null,
"error": null
}
This command may be exited via ctrl+c without affecting the request.
[-]
Running...
2016-03-03 07:23:38,062 - DEBUG - sending GET request to /pulp/api/v2/tasks/c06bfa97-95b0-40ca-b9f1-02aea3d0e55a/
2016-03-03 07:23:38,142 - INFO - GET request to /pulp/api/v2/tasks/c06bfa97-95b0-40ca-b9f1-02aea3d0e55a/ with parameters None
2016-03-03 07:23:38,143 - INFO - Response status : 200
2016-03-03 07:23:38,143 - INFO - Response body :
{
"exception": null,
"task_type": "pulp.server.managers.repo.unit_association.unassociate_by_criteria",
"_href": "/pulp/api/v2/tasks/c06bfa97-95b0-40ca-b9f1-02aea3d0e55a/",
"task_id": "c06bfa97-95b0-40ca-b9f1-02aea3d0e55a",
"tags": [
"pulp:repository:ideate",
"pulp:action:unassociate"
],
"finish_time": "2016-03-03T12:23:37Z",
"_ns": "task_status",
"start_time": "2016-03-03T12:23:37Z",
"traceback": null,
"spawned_tasks": [],
"progress_report": {},
"queue": "reserved_resource_worker-1@ip-10-15-2-47.eu-west-1.compute.internal.dq",
"state": "finished",
"worker_name": "reserved_resource_worker-1@ip-10-15-2-47.eu-west-1.compute.internal",
"result": {
"units_successful": [
{
"unit_key": {
"repo_id": "ideate",
"id": "mammal"
},
"type_id": "package_group"
}
]
},
"error": null,
"_id": {
"$oid": "56d82cc9cbba263a6aedbbd1"
},
"id": "56d82cc9cbba263a6aedbbd1"
[\]
Running...
Units Removed:
mammal
# create and sync repo again
$ http POST https://host/pulp/api/v2/repositories/ideate/actions/unassociate/ --verify=cert.crt -vvv --auth=admin:admin <<< '{"criteria": {"type_ids": ["package_group"], "filters": {"unit": {"id": {"$in": ["mammal"]}}}}}'
POST /pulp/api/v2/repositories/ideate/actions/unassociate/ HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Authorization: Basic YWRtaW46YWRtaW4=
Connection: keep-alive
Content-Length: 96
Content-Type: application/json
Host: host
User-Agent: HTTPie/0.9.2
{
"criteria": {
"filters": {
"unit": {
"id": {
"$in": [
"mammal"
]
}
}
},
"type_ids": [
"package_group"
]
}
}
HTTP/1.1 202 ACCEPTED
Connection: Keep-Alive
Content-Length: 172
Content-Type: application/json; charset=utf-8
Date: Thu, 03 Mar 2016 12:29:14 GMT
Keep-Alive: timeout=5, max=10000
Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
{
"error": null,
"result": null,
"spawned_tasks": [
{
"_href": "/pulp/api/v2/tasks/e81fd2a4-8975-46c5-8c71-275f044da425/",
"task_id": "e81fd2a4-8975-46c5-8c71-275f044da425"
}
]
}
$ pulp-admin rpm repo content group --repo-id=ideate
Conditional Package Names:
Default Package Names:
Id: bird
Mandatory Package Names: penguin
Name: bird
Optional Package Names:
User Visible: True
Updated by dkliban@redhat.com almost 9 years ago
- Status changed from 6 to CLOSED - CURRENTRELEASE
unit association query uses model serializers
When building mongo queries, UnitAssociationQuery wasn't translating the incoming fields to their proper mongo fields via the model serializer.
To start, this change makes "public" the serializer translate methods that provide useful functionality when incoming criteria get broken down into their actual mongo queries.
Then, those public methods are used by UnitAssociationQuery to translate model fields before building queries to mongo.
https://pulp.plan.io/issues/1527 fixes #1527
https://pulp.plan.io/issues/1533 re #1533
https://pulp.plan.io/issues/1534 fixes #1534
https://pulp.plan.io/issues/1535 re #1535