You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 30, 2020. It is now read-only.
[18/Apr/2013 04:38:17] "PUT /api/data/users/django HTTP/1.0" 500 641
DEBUG Traceback (most recent call last):
File "/var/django/current/commis/utils/chef_api.py", line 101, in execute_request
data = view(request, _args, *_kwargs)
File "/var/django/current/commis/generic_views/api.py", line 62, in wrapper_view
return view(self.instance, request, _args, *_kwargs)
File "/var/django/current/commis/generic_views/api.py", line 22, in inner
return fn(_args, *_kwargs)
File "/var/django/current/commis/data_bags/views.py", line 53, in item_update
raise ChefAPIError(500, 'Name mismatch in data bag item')
ChefAPIError
DEBUG {
"error": "Name mismatch in data bag item"
}
After debugging a bit, I found that the server is looking for the item json data directly in the raw post data, but in fact knife is sending it within a larger json document, in the raw_data attribute.
Did the knife client change recently ?
Thanks for your help.
The text was updated successfully, but these errors were encountered:
Ok, I fixed this by replacing the item_update method in commis/data_bags/views.py:
@api('PUT', admin=True)
def item_update(self, request, bag_name, name):
if not request.json:
raise ChefAPIError(500, 'No data sent')
data = request.json.get('raw_data')
if not isinstance(data, dict):
data = request.json
if not isinstance(data, dict) or data.get('id') != name:
raise ChefAPIError(500, 'Name mismatch in data bag item')
item = self.get_item_or_404(bag_name, name)
update(item, data=json.dumps(data, indent=4))
return HttpResponse(item.data, status=200, content_type='application/json')
Yeah, this changed some time during chef 10 maintenance I think so as long as that is backwards compatible (which is it seems to be) send over a patch :)
I get HTTP 500 Errors when trying to upload a data bag item from a file:
$ knife --version
Chef: 11.4.0
$ ruby --version
ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-darwin11.4.2]
$ knife data bag from file users data_bags/users/django.json
ERROR: Server returned error for http://54.246.162.231:8000/api/data/users/django, retrying 1/5 in 4s
ERROR: Server returned error for http://54.246.162.231:8000/api/data/users/django, retrying 2/5 in 5s
ERROR: Server returned error for http://54.246.162.231:8000/api/data/users/django, retrying 3/5 in 11s
ERROR: Server returned error for http://54.246.162.231:8000/api/data/users/django, retrying 4/5 in 19s
ERROR: Server returned error for http://54.246.162.231:8000/api/data/users/django, retrying 5/5 in 51s
ERROR: internal server error
Response: Name mismatch in data bag item
Here's the error on the server side:
[18/Apr/2013 04:38:17] "PUT /api/data/users/django HTTP/1.0" 500 641
DEBUG Traceback (most recent call last):
File "/var/django/current/commis/utils/chef_api.py", line 101, in execute_request
data = view(request, _args, *_kwargs)
File "/var/django/current/commis/generic_views/api.py", line 62, in wrapper_view
return view(self.instance, request, _args, *_kwargs)
File "/var/django/current/commis/generic_views/api.py", line 22, in inner
return fn(_args, *_kwargs)
File "/var/django/current/commis/data_bags/views.py", line 53, in item_update
raise ChefAPIError(500, 'Name mismatch in data bag item')
ChefAPIError
DEBUG {
"error": "Name mismatch in data bag item"
}
After debugging a bit, I found that the server is looking for the item json data directly in the raw post data, but in fact knife is sending it within a larger json document, in the raw_data attribute.
Did the knife client change recently ?
Thanks for your help.
The text was updated successfully, but these errors were encountered: