-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
While experimenting with the platform I encountered some problems with the creation of devices and with creation and listing of templates. I still don't know if I'm doing something wrong while configuring the Dojot plataform or something alike.
I used the following command to create the device:
curl -X POST http://localhost:8000/device -H "Authorization: Bearer ${JWT}" -H 'Content-Type:application/json' -d '{
"label": "SensorModel",
"attrs": [
{
"label": "temperature",
"type": "dynamic",
"value_type": "float"
}
] }'
This is the reply from the Device-Manager:
{"msg": "Internal Error"}
By looking with the docker-composer I got the following error:
auth_1 | 2018-02-05 15:31:20,937 - INFO - user 1 permit to POST on /device/
auth_1 | 172.19.0.17 - - [05/Feb/2018:15:31:20 +0000] "POST /pdp HTTP/1.1" 200 38 "-" "LuaSocket 3.0-rc1"
device-manager_1 | [2018-02-05 15:31:20,943] ERROR in app: Exception on /device [POST]
device-manager_1 | Traceback (most recent call last):
device-manager_1 | File "/usr/local/lib/python2.7/site-packages/Flask-0.12-py2.7.egg/flask/app.py", line 1982, in wsgi_app
device-manager_1 | response = self.full_dispatch_request()
device-manager_1 | File "/usr/local/lib/python2.7/site-packages/Flask-0.12-py2.7.egg/flask/app.py", line 1614, in full_dispatch_request
device-manager_1 | rv = self.handle_user_exception(e)
device-manager_1 | File "/usr/local/lib/python2.7/site-packages/Flask-0.12-py2.7.egg/flask/app.py", line 1517, in handle_user_exception
device-manager_1 | reraise(exc_type, exc_value, tb)
device-manager_1 | File "/usr/local/lib/python2.7/site-packages/Flask-0.12-py2.7.egg/flask/app.py", line 1612, in full_dispatch_request
device-manager_1 | rv = self.dispatch_request()
device-manager_1 | File "/usr/local/lib/python2.7/site-packages/Flask-0.12-py2.7.egg/flask/app.py", line 1598, in dispatch_request
device-manager_1 | return self.view_functions[rule.endpoint](**req.view_args)
device-manager_1 | File "/usr/src/app/DeviceManager/DeviceManager.py", line 128, in create_device
device-manager_1 | device_data, json_payload = parse_payload(request, device_schema)
device-manager_1 | File "/usr/src/app/DeviceManager/SerializationModels.py", line 72, in parse_payload
device-manager_1 | data, errors = schema.load(json_payload)
device-manager_1 | ValueError: need more than 1 value to unpack
device-manager_1 | 172.19.0.17 - - [05/Feb/2018:15:31:20 +0000] "POST /device HTTP/1.1" 500 25 "-" "curl/7.35.0"
Creating or listing templates also gives an error, giving the same error message to a POST, but with the following output on docker-composer:
GET:
curl -X GET http://localhost:8000/template -H "Authorization: Bearer ${JWT}"
Reply:
{"msg": "Internal Error"}
Docker-Composer output:
auth_1 | 2018-02-05 15:33:45,495 - INFO - user 1 permit to GET on /template/
auth_1 | 172.19.0.17 - - [05/Feb/2018:15:33:45 +0000] "POST /pdp HTTP/1.1" 200 38 "-" "LuaSocket 3.0-rc1"
device-manager_1 | [2018-02-05 15:33:45,515] ERROR in app: Exception on /template [GET]
device-manager_1 | Traceback (most recent call last):
device-manager_1 | File "/usr/local/lib/python2.7/site-packages/Flask-0.12-py2.7.egg/flask/app.py", line 1982, in wsgi_app
device-manager_1 | response = self.full_dispatch_request()
device-manager_1 | File "/usr/local/lib/python2.7/site-packages/Flask-0.12-py2.7.egg/flask/app.py", line 1614, in full_dispatch_request
device-manager_1 | rv = self.handle_user_exception(e)
device-manager_1 | File "/usr/local/lib/python2.7/site-packages/Flask-0.12-py2.7.egg/flask/app.py", line 1517, in handle_user_exception
device-manager_1 | reraise(exc_type, exc_value, tb)
device-manager_1 | File "/usr/local/lib/python2.7/site-packages/Flask-0.12-py2.7.egg/flask/app.py", line 1612, in full_dispatch_request
device-manager_1 | rv = self.dispatch_request()
device-manager_1 | File "/usr/local/lib/python2.7/site-packages/Flask-0.12-py2.7.egg/flask/app.py", line 1598, in dispatch_request
device-manager_1 | return self.view_functions[rule.endpoint](**req.view_args)
device-manager_1 | File "/usr/src/app/DeviceManager/TemplateManager.py", line 36, in get_templates
device-manager_1 | templates = template_list_schema.dump(page.items).data
device-manager_1 | AttributeError: 'list' object has no attribute 'data'
device-manager_1 | 172.19.0.17 - - [05/Feb/2018:15:33:45 +0000] "GET /template HTTP/1.1" 500 25 "-" "curl/7.35.0"