update item fails with 500 error for non-existent item
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MagnetoDB |
Fix Released
|
Medium
|
Charles Wang |
Bug Description
According to API doc:
update_item
If no item with the specified key is found:
PUT - MagnetoDB creates a new item with the specified primary key, and then adds the attribute.
DELETE - Nothing happens; there is no attribute to delete.
ADD - MagnetoDB creates an item with the supplied primary key and number (or set of numbers) for the attribute value. The only data types allowed are number and number set; no other data types can be specified.
Steps to reproduce:
1. create a table with 3 fields, one field as hash key, one field as range key
2. update_item, with attribute_updates set to a new attribute of type SS, such as
"attribute_
"Tags": {
"value": {
"SS": ["some string"]
}
}
3. API returns the following error response:
explanation: "The server has either erred or is incapable of performing the requested operation."
code: 500
-error: {
message: "'NoneType' object has no attribute 'iteritems'"
traceback: null
type: "AttributeError"
}
title: "Internal Server Error"
MagnetoDB log:
2014-09-24 17:21:29.266 15395 ERROR magnetodb.
Traceback (most recent call last):
File "/Users/
return req.get_
File "/Users/
application, catch_exc_
File "/Users/
app_iter = application(
File "/Users/
resp = self.call_func(req, *args, **self.kwargs)
File "/Users/
return self.func(req, *args, **kwargs)
File "/Users/
response = req.get_
File "/Users/
application, catch_exc_
File "/Users/
app_iter = application(
File "/Users/
return resp(environ, start_response)
File "/Users/
response = self.app(environ, start_response)
File "/Users/
return resp(environ, start_response)
File "/Users/
resp = self.call_func(req, *args, **self.kwargs)
File "/Users/
return self.func(req, *args, **kwargs)
File "/Users/
action_result = self.execute_
File "/Users/
return self.dispatch(
File "/Users/
return method(*args, **kwargs)
File "/Users/
return f(*args, **kwargs)
File "/Users/
expected_
File "/Users/
expected_
File "/Users/
expected_
File "/Users/
return f(*args, **kwargs)
File "/Users/
key_
File "/Users/
for attr_name, attr_value in old_item.
AttributeError: 'NoneType' object has no attribute 'iteritems'
127.0.0.1 - - [24/Sep/2014 17:21:29] "POST /v1/default_
Changed in magnetodb: | |
importance: | Undecided → Medium |
milestone: | none → juno-rc1 |
Changed in magnetodb: | |
status: | Fix Committed → Fix Released |
proposed fix: https:/ /review. openstack. org/#/c/ 123927/