Story #178
closed[RFE] Consider support for validating unit profiles
0%
Description
++ This bug was initially created as a clone of Bugzilla Bug #947144 ++
Description of problem:
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