Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 947144

Summary: [RFE] Consider support for validating unit profiles
Product: [Retired] Pulp Reporter: Jay Dobies <jason.dobies>
Component: consumersAssignee: pulp-bugs
Status: CLOSED UPSTREAM QA Contact: Preethi Thomas <pthomas>
Severity: medium Docs Contact:
Priority: medium    
Version: MasterCC: jsherril, mhrivnak, rbarlow
Target Milestone: ---Keywords: FutureFeature, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-19 01:04:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jay Dobies 2013-04-01 18:16:11 UTC
We may need to add something to the Profiler API that verifies a unit profile before Pulp saves it on the consumer. This originally came from another bug filed by Katello (that bug had two separate issues, this is tracking the validation portion):


In addition, no validation appears to be performed on the profile, so i could pass something like as the unit profile:


{
"_id": {
    "$oid": "51360d559c60ed183200005e"
},
"_ns": "consumer_unit_profiles",
"consumer_id": "22eaa87c-76a1-4d5a-af34-f6a167e3bc44",
"content_type": "rpm",
"id": "51360d559c60ed183200005e",
"profile": [ {"version": "1.0", "name": "zsh"}  ]
}


which is accepted perfectly fine (even though its invalid).  However very bad things happen, as you cannot delete the consumer after you do this, or retrieve the unit profile.  

For example, here's a partial traceback I get when trying to delete:

  File "/usr/lib64/python2.6/site-packages/pymongo/database.py", line 663, in dereference
    return self[dbref.collection].find_one({"_id": dbref.id})
  File "/usr/lib64/python2.6/site-packages/pymongo/collection.py", line 520, in find_one
    for result in self.find(spec_or_id, *args, **kwargs).limit(-1):
  File "/usr/lib64/python2.6/site-packages/pymongo/cursor.py", line 703, in next
    if len(self.__data) or self._refresh():
  File "/usr/lib64/python2.6/site-packages/pymongo/cursor.py", line 666, in _refresh
    self.__uuid_subtype))
  File "/usr/lib64/python2.6/site-packages/pymongo/cursor.py", line 628, in __send_message
    self.__tz_aware)
  File "/usr/lib64/python2.6/site-packages/pymongo/helpers.py", line 101, in _unpack_response
    error_object["$err"])
pymongo.errors.OperationFailure: database error: invalid operator: $oid

Comment 1 Brian Bouterse 2015-02-19 01:04:01 UTC
Moved to https://pulp.plan.io/issues/178