Project

General

Profile

Bug #10116

BMC is not able to use parameters passed in through body

Added by Corey Osman almost 8 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
BMC
Target version:
Difficulty:
easy
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

This have been broken since initial release of BMC code, the problem appears that because Sinatra does not parse the body of the request into the params object, there is no way for the user to pass in additional options to choose a provider. The unit tests were setup to pass this in with the params so the problem has been masked for quite a while. Additional, if users have been using a default provider they would not have noticed an issue either. This was really just an issue with my perception of how Sinatra worked.

This issue was found by using curl and passing in data through the body of the request and the smart-proxy was not getting access to these additional options.

Example Call

curl -vks --header "Content-Type: application/json" -d '{"bmc_provider":"freeipmi", "options":{"driver":"lan20"}}' 'http://127.0.0.1:8443/bmc/192.168.1.21/chassis/power/off' -X PUT -u admin:password
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8888 (#0)
* Server auth using Basic with user 'admin'
> PUT http://127.0.0.1:8443/bmc/192.168.1.21/chassis/power/off HTTP/1.1
> Authorization: Basic YWRtaW46cGFzc3dvcmQ=
> User-Agent: curl/7.37.1
> Host: 127.0.0.1:8443
> Accept: */*
> Proxy-Connection: Keep-Alive
> Content-Type: application/json
> Content-Length: 57
>
* upload completely sent off: 57 out of 57 bytes
< HTTP/1.1 200 OK
< Content-Type: text/html;charset=utf-8
< Content-Length: 46
< X-Xss-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
* Server WEBrick/1.3.1 (Ruby/2.1.5/2014-11-13) OpenSSL/1.0.1j is not blacklisted
< Server: WEBrick/1.3.1 (Ruby/2.1.5/2014-11-13) OpenSSL/1.0.1j
< Date: Fri, 10 Apr 2015 21:10:41 GMT
< Proxy-Connection: Keep-alive
<
* Connection #0 to host 127.0.0.1 left intact
{"action":"off","result":"192.168.1.21: ok\n"}


Related issues

Related to Smart Proxy - Bug #7543: allow additional rubyipmi connection options to be passed throughClosed2014-09-19

Associated revisions

Revision 6ebc1ccd (diff)
Added by Corey Osman almost 8 years ago

Fixes #10116 - BMC is not able to use parameters passed in through body

  • adds new helper method to parse body as json and return hash
  • protects against bad data being passed into options hash

History

#1 Updated by The Foreman Bot almost 8 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/smart-proxy/pull/275 added
  • Pull request deleted ()

#2 Updated by Dominic Cleal almost 8 years ago

  • Related to Bug #7543: allow additional rubyipmi connection options to be passed through added

#3 Updated by Corey Osman almost 8 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#4 Updated by Dominic Cleal almost 8 years ago

  • Legacy Backlogs Release (now unused) set to 35

Also available in: Atom PDF