Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Problem while passing string and integer together in REST #20

Closed
rahulmah opened this issue Apr 22, 2016 · 2 comments
Closed

Problem while passing string and integer together in REST #20

rahulmah opened this issue Apr 22, 2016 · 2 comments
Assignees

Comments

@rahulmah
Copy link

For setting syslog, we have pass directory of string(for ip address) and integer (for port no.). If we try to give both of them (as below), I am getting "Expected a string or unicode object" error.

If we try to set ip address(as string) and port no.(as integer) separately, then we do not see any problem.

rahuls-MacBook-Pro:~ rahulmaheshwari$ curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST -d "{"data": [{"ipaddr":"9.109.116.67", "port": 500}]}" ttps://9.3.164.147/org/openbmc/LogManager/rsyslog/action/Enable
{
"data": {
"description": "Internal Server Error",
"exception": "TypeError('Expected a string or unicode object',)",
"traceback": [
"Traceback (most recent call last):",
" File "/usr/lib/python2.7/site-packages/bottle.py", line 862, in _handle",
" return route.call(*_args)",
" File "/usr/lib/python2.7/site-packages/bottle.py", line 1734, in wrapper",
" rv = callback(_a, **ka)",
" File "/usr/sbin/obmc-rest", line 616, in call",
" return self.callback(_a, *_kw)",
" File "/usr/sbin/obmc-rest", line 707, in wrap",
" resp = {'data': callback(_a, *_kw)}",
" File "/usr/sbin/obmc-rest", line 670, in wrap",
" return callback(_a, *_kw)",
" File "/usr/sbin/obmc-rest", line 695, in wrap",
" return callback(_a, kw)",
" File "/usr/sbin/obmc-rest", line 105, in call",
" return getattr(self, 'do
' + request.method.lower())(
_kw)",
" File "/usr/sbin/obmc-rest", line 282, in do_post",
" return request.route_data'method'",
" File "/usr/lib/python2.7/site-packages/dbus/proxies.py", line 145, in call",
" *_keywords)",
" File "/usr/lib/python2.7/site-packages/dbus/connection.py", line 641, in call_blocking",
" message.append(signature=signature, *args)",
"TypeError: Expected a string or unicode object"
]
},
"message": "500 Internal Server Error",
"status": "error"
}rahuls-MacBook-Pro:~ rahulmaheshwari$ curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST -d "{"data": [{"ipaddr":"9.109.116.67"}]}" https://9.3.164147/org/openbmc/LogManager/rsyslog/action/Enable
{
"data": 0,
"message": "200 OK",
"status": "ok"
}rahuls-MacBook-Pro:~ rahulmaheshwari$ curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST -d "{"data": [{"port": 500}]}" https://9.3.164.147/org/openbc/LogManager/rsyslog/action/Enable
{
"data": 0,
"message": "200 OK",
"status": "ok"
}rahuls-MacBook-Pro:~ rahulmaheshwari$

@bradbishop
Copy link
Member

Just to make sure, is the dbus signature for the parameter of the Enable method a{sv} ?

@bradbishop
Copy link
Member

@rahulmah please reopen if you can recreate this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants