Story #219
closedList the invalid value in InvalidValue exceptions
0%
Description
++ This bug was initially created as a clone of Bugzilla Bug #1058927 ++
Description of problem:
I spent a few hours today trying to debug this error from pulp:
{"http_request_method": "POST", "exception": null, "error_message": "Invalid properties: ['distributor_type_id']", "property_names": ["distributor_type_id"], "_href": "/pulp/api/v2/repositories/", "http_status": 400, "traceback": null}
The acutal issue was that I was passing in a request to create a new disributor with the following json:
/pulp/api/v2/repositories/
post
{"id":"DemoOrg-wordpress-r6","display_name":"r6","importer_type_id":"yum_importer","importer_config":{"ssl_ca_cert":null,"ssl_client_cert":null,"ssl_client_key":null,"feed":"http://10.13.137.92/lab/wordpress/el6/x86_64/"},"notes":{"_repo-type":"rpm-repo"},"distributors":[{"distributor_type":"yum_distributor","distributor_config":{"relative_url":"DemoOrg/Library/custom/wordpress/r6","http":true,"https":true,"protected":true},"auto_publish":true,"distributor_id":"DemoOrg-wordpress-r6"},{"distributor_type":"yum_clone_distributor","distributor_config":{"destination_distributor_id":"DemoOrg-wordpress-r6"},"auto_publish":false,"distributor_id":"DemoOrg-wordpress-r6_clone"},{"distributor_type":"nodes_http_distributor","distributor_config":{},"auto_publish":true,"distributor_id":"DemoOrg-wordpress-r6_nodes"}\]}
{"content_type"=>"application/json", "accept"=>"application/json", "Authorization"=>"OAuth oauth_body_hash=\"2jmj7l5rSw0yVb%2FvlWAYkK%2FYBwk%3D\", oauth_consumer_key=\"katello\", oauth_nonce=\"Vq0XTFThBe6ggweXskL10MfVxAFDHQIOCIMbRHUc0\", oauth_signature=\"GvyE8aXP%2B0GLc4EyuHkrQjTUIDQ%3D\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1390932025\", oauth_version=\"1.0\"", "pulp-user"=>"admin"}
The error message is bad for two reasons:
1) The parameter it specifies (distributor_type_id) is not in the json.
2) I have no idea what the actual invalid piece of data was
It was failing on the fact that I did not have pulp-nodes-parent installed and I passed in "distributor_type":"nodes_http_distributor". It would have been much easier to have seen the invalid data as well to help me on my debugging. If I had seen a message which was:
{"http_request_method": "POST", "exception": null, "error_message": "Invalid properties: ['distributor_type_id'] values: ['nodes_http_distributor']", "property_names": ["distributor_type_id"], "_href": "/pulp/api/v2/repositories/", "http_status": 400, "traceback": null}
It would have been much nicer.