Project

Profile

Help

Issue #1886

closed

Removal of the unit fails if criteria contains unknown fields

Added by ttereshc over 6 years ago. Updated over 3 years ago.

Status:
CLOSED - WONTFIX
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:
Pulp 2
Sprint:
Quarter:

Description

It does not make sense to specify fields during removal, but I was told that in Pulp 2.5 the absence of the fields key in the criteria would result in a KeyError.
So maybe it is better to tell explicitly that it is not allowed to use fields during removal.

For Docker plugin failure happens only during removal.
If you specify unknown fields during search of the docker unit - no problem.

$ curl -H "Accept: application/json" -X POST -d '{"criteria": {"fields": {"unit": ["id", "_id", "image_id"]}, "type_ids": ["docker_image"], "filters": {"unit": {"image_id": "4b51ded9aed1607365d12758fa63fd011891a3f25249d3cd8783a56b8529d197"}}}}' -k -u admin:admin 'https://localhost/pulp/api/v2/repositories/busybox/actions/unassociate/'
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952) Traceback (most recent call last):
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/usr/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     R = retval = fun(*args, **kwargs)
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/home/user1/devel/pulp/server/pulp/server/async/tasks.py", line 473, in __call__
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     return super(Task, self).__call__(*args, **kwargs)
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/home/user1/devel/pulp/server/pulp/server/async/tasks.py", line 103, in __call__
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     return super(PulpTask, self).__call__(*args, **kwargs)
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/usr/lib/python2.7/site-packages/celery/app/trace.py", line 437, in __protected_call__
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     return self.run(*args, **kwargs)
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/home/user1/devel/pulp/server/pulp/server/managers/repo/unit_association.py", line 360, in unassociate_by_criteria
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     transfer_units = list(cls._units_from_criteria(repo, criteria))
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/home/user1/devel/pulp/server/pulp/server/controllers/repository.py", line 225, in find_repo_content_units
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     qs = qs.only(*unit_fields)
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/usr/lib/python2.7/site-packages/mongoengine/queryset/base.py", line 812, in only
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     return self.fields(True, **fields)
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/usr/lib/python2.7/site-packages/mongoengine/queryset/base.py", line 866, in fields
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     fields = queryset._fields_to_dbfields(fields)
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/usr/lib/python2.7/site-packages/mongoengine/queryset/base.py", line 1676, in _fields_to_dbfields
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     raise err
Apr 30 21:50:54 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952) LookUpError: Cannot resolve field "_id"

For RPM plugin both search and removal will fail in the same way.

Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952) Traceback (most recent call last):
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/usr/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     R = retval = fun(*args, **kwargs)
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/home/user1/devel/pulp/server/pulp/server/async/tasks.py", line 473, in __call__
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     return super(Task, self).__call__(*args, **kwargs)
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/home/user1/devel/pulp/server/pulp/server/async/tasks.py", line 103, in __call__
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     return super(PulpTask, self).__call__(*args, **kwargs)
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/usr/lib/python2.7/site-packages/celery/app/trace.py", line 437, in __protected_call__
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     return self.run(*args, **kwargs)
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/home/user1/devel/pulp/server/pulp/server/managers/repo/unit_association.py", line 350, in unassociate_by_criteria
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     unassociate_units = load_associated_units(repo_id, criteria)
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/home/user1/devel/pulp/server/pulp/server/managers/repo/unit_association.py", line 440, in load_associated_units
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     associate_us = association_query_manager.get_units(source_repo_id, criteria=criteria)
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/home/user1/devel/pulp/server/pulp/server/managers/repo/unit_association_query.py", line 131, in get_units
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     units_generator = itertools.chain(*units_cursors)
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/home/user1/devel/pulp/server/pulp/server/managers/repo/unit_association_query.py", line 436, in _associated_units_cursors_with_limit
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     for cursor in unit_cursors:
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/home/user1/devel/pulp/server/pulp/server/managers/repo/unit_association_query.py", line 406, in _associated_units_cursors_with_skip
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     for cursor in units_cursors:
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/home/user1/devel/pulp/server/pulp/server/managers/repo/unit_association_query.py", line 120, in <genexpr>
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     for t in association_unit_types if t in associations_lookup)
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/home/user1/devel/pulp/server/pulp/server/managers/repo/unit_association_query.py", line 372, in _associated_units_by_type_cursor
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     fields[index] = serializer.translate_field(serializer.model, field)
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)   File "/home/user1/devel/pulp/server/pulp/server/webservices/views/serializers/__init__.py", line 305, in translate_field
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952)     field, model._meta['collection']))
Apr 30 22:33:32 dev pulp[6896]: celery.worker.job:ERROR: (6896-85952) InvalidValue: Invalid properties: ['Field: <_id> does not exist on objects in the <units_rpm> collection']

I have not checked other plugins.

Also available in: Atom PDF