Coder Social home page Coder Social logo

Comments (7)

adamliyi avatar adamliyi commented on August 30, 2024

Please see PR: #50
An exception will be returned when setting the power cap value out of range:

curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST -d "{"data": [ 1900 ]}" https://9.3.23.24/org/openbmc/sensors/hot/PowerCap/action/setValue
{
"data": {
"description": "Internal Server Error",
"exception": "DBusException('Set PowerCap error: check value range',)",
"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 569, in call",
" return self.callback(_a, *_kw)",
" File "/usr/sbin/obmc-rest", line 657, in wrap",
" resp = { 'data': callback(_a, *_kw) }",
" File "/usr/sbin/obmc-rest", line 622, in wrap",
" return callback(_a, *_kw)",
" File "/usr/sbin/obmc-rest", line 646, in wrap",
" return callback(_a, kw)",
" File "/usr/sbin/obmc-rest", line 79, in call",
" return getattr(self, 'do
' + request.method.lower())(
_kw)",
" File "/usr/sbin/obmc-rest", line 240, 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 651, in call_blocking",
" message, timeout)",
"DBusException: org.freedesktop.DBus.Python.dbus.exceptions.DBusException: Set PowerCap error: check value range"
]
},
"message": "500 Internal Server Error",
"status": "error"
}

from skeleton.

mkumatag avatar mkumatag commented on August 30, 2024

500 internal error is not really accepted, we should through 4xx series error. You can refer https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_Error to understand more about errors.

from skeleton.

adamliyi avatar adamliyi commented on August 30, 2024

Thanks Manjunath for reminding. I need to check with Brad.

from skeleton.

adamliyi avatar adamliyi commented on August 30, 2024

Updated the PR.
Here is the new return code when setting invalid power cap value:

curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST -d "{"data": [ 2000 ]}" https://9.3.23.24/org/openbmc/sensors/host/PowerCap/action/setValue
{
"data": {
"description": "org.freedesktop.DBus.Error.InvalidArgs: Set PowerCap error: check value range"
},
"message": "400 Bad Request",
"status": "error"
}

from skeleton.

adamliyi avatar adamliyi commented on August 30, 2024

@mkumatag , I've setup the barreley 9.3.23.24. Could you please verify issue #42, and issue #43.

I have replaced the two files on that server with my fix.
/usr/sbin/Sensors.py and /usr/sbin/sensor_manager2.py

Thanks,

from skeleton.

mkumatag avatar mkumatag commented on August 30, 2024

I just verified the tests on that machine for issue #43 and working fine.


Test Occ Powercap :: This suite is for testing OCC: Power capping ... | PASS |
6 critical tests, 6 passed, 0 failed

6 tests total, 6 passed, 0 failed

Output: /home/manjunath/git/openbmc-automation/output.xml
Log: /home/manjunath/git/openbmc-automation/log.html
Report: /home/manjunath/git/openbmc-automation/report.html
______________________________________________________________________________________________ summary ______________________________________________________________________________________________
custom: commands succeeded
congratulations :)
[manjunath@oc1275007250 openbmc-automation]$

from skeleton.

mkumatag avatar mkumatag commented on August 30, 2024

Why this issue has been closed? is code already merged?

from skeleton.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.