Issue #2797
closedSingle consumer aplicability generation does not work unless profile already has applicability generated
Description
Recently the pulp team advised the katello team to start using the single consumer applicability generation api here:
POST /pulp/api/v2/consumers/UUID/actions/content/regenerate_applicability/
however this does not seem to work unless the profile has already been generated.
Steps to reproduce:
On a fresh pulp server (or a pulp server that has never had this consumer registered with its package profile):
a) sync a repository with errata (such as https://jlsherrill.fedorapeople.org/fake-repos/needed-errata/)
b) register a consumer, upload its package profile with some older package than what is in the repo with an errata (such as walrus 0.71)
c) bind the consumer to the repository
d) generate applicability using the api above
e) fetch applicability using:
POST /pulp/api/v2/consumers/content/applicability/ with body:
{
'criteria' : { 'filters' : { 'id' : { '$in' : [UUID] } } },
'content_types' : ['errata']
}
note that the list is empty. If you generate it using this api that we have been using for years it works fine:
POST /pulp/api/v2/consumers/actions/content/regenerate_applicability/
{
'consumer_criteria' => { 'filters' : { 'id' : { '$in' => [UUID] } } }
}
Note that once the profile is generated, it seems that the single consumer api seems to work fine.
Updated by ttereshc over 7 years ago
- Priority changed from Normal to High
- Severity changed from 2. Medium to 3. High
- Triaged changed from No to Yes
Updated by cduryee over 7 years ago
It looks like there is an error in the Criteria obj created, it looks for 'consumer_id' instead of just 'id'. for example:
{'sort': None, 'skip': None, 'limit': None, 'filters': {'consumer_id': {'$eq': u'e1d8a941-c991-4235-9e99-f666f9236b90'}}, 'fields': None, '_id': ObjectId('5936cdef280a9f4d33ce55f8'), 'id': '5936cdef280a9f4d33ce55f8'}
(the one above has an extra $eq but you get the idea)
but the mongo document is:
{ "_id" : ObjectId("5936c1c5280a9f3673e58313"), "display_name" : "applic-katello-3-4.example.com", "description" : null, "_ns" : "consumers", "notes" : { }, "rsa_pub" : null, "capabilities" : { }, "id" : "e1d8a941-c991-4235-9e99-f666f9236b90" }
changing 'consumer_id' to 'id' in https://github.com/pulp/pulp/blob/master/server/pulp/server/webservices/views/consumers.py#L954 seems to make things happier.
Updated by amacdona@redhat.com over 7 years ago
I think this is the culprit: https://github.com/pulp/pulp/blob/master/server/pulp/server/webservices/views/consumers.py#L954
Another possibility and next step:
For models that were converted to mongoengine models (consumers were not) we have an internal translation to maintain backwards compatibility, but it should not be running on consumers. This is the line to start with to determine if translation is happening.
Added by ttereshc over 7 years ago
Updated by ttereshc over 7 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to ttereshc
- Sprint/Milestone set to 39
Updated by ttereshc over 7 years ago
- Status changed from ASSIGNED to MODIFIED
Applied in changeset pulp:pulp|81e350c09e2b0a767d45958f64abb6e472e7c076.
Updated by pcreech over 7 years ago
- Status changed from 5 to CLOSED - CURRENTRELEASE
Updated by Exercitatio about 4 years ago
The people has talk about the character of Nigerian people on one Africa and take twist from this. I guess to some extent that the people of Nigeria is Fulfillment center philippines and a great nation in making.
Fix criteria obj for consumer in applicability regeneration view
All kudos go to Chris (cduryee).
closes #2797 https://pulp.plan.io/issues/2797