Bug 848956 - Rest api for list plans via XML is not working
Rest api for list plans via XML is not working
Status: CLOSED CURRENTRELEASE
Product: OpenShift Origin
Classification: Red Hat
Component: REST API (Show other bugs)
2.x
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Lili Nader
libra bugs
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-16 18:46 EDT by Chandrika Gole
Modified: 2015-05-14 20:51 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-09-17 17:29:15 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Chandrika Gole 2012-08-16 18:46:54 EDT
Description of problem:
REST api for 

Version-Release number of selected component (if applicable):
devenv_2005

How reproducible:
Always

Steps to Reproduce:
1. Try curl -3 -k -H "Accept: application/xml" --user "cgole@redhat.com:redhat" https://ec2-107-22-85-244.compute-1.amazonaws.com/broker/rest/plans

2.
3.
  
Actual results:
This fails

Expected results:
Should return the list of plans

Additional info:
Attached the full response for this request

<h1>
  NoMethodError
    in PlansController#index
</h1>
<pre>super: no superclass method `to_xml' for #&lt;RestPlan:0x7fd130c1e180&gt;</pre>


<p><code>Rails.root: /var/www/stickshift/broker</code></p>

<div id="traces">
    <a href="#" onclick="document.getElementById('Framework-Trace').style.display='none';document.getElementById('Full-Trace').style.display='none';document.getElementById('Application-Trace').style.display='block';; return false;">Application Trace</a> |
    <a href="#" onclick="document.getElementById('Application-Trace').style.display='none';document.getElementById('Full-Trace').style.display='none';document.getElementById('Framework-Trace').style.display='block';; return false;">Framework Trace</a> |
    <a href="#" onclick="document.getElementById('Application-Trace').style.display='none';document.getElementById('Framework-Trace').style.display='none';document.getElementById('Full-Trace').style.display='block';; return false;">Full Trace</a>
Comment 1 Meng Bo 2012-08-16 22:58:01 EDT
Checked this on devenv_2008, list plan via REST API got correct info when using json format. And will get the same issue with xml format

[root@domU-12-31-39-0B-E0-61 cartridges]# curl -3 -k -H "Accept: application/json" --user "bmeng@redhat.com:123456"  https://localhost/broker/rest/plans/ -X GET |python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
120   362    0   362    0     0   5469      0 --:--:-- --:--:-- --:--:-- 36200
{
    "data": [
        {
            "capabilities": {
                "gear_sizes": [
                    "small"
                ], 
                "max_gears": 3
            }, 
            "id": "freeshift", 
            "name": "FreeShift", 
            "plan_no": 10044929
        }, 
        {
            "capabilities": {
                "gear_sizes": [
                    "small", 
                    "medium"
                ], 
                "max_gears": 16, 
                "max_storage_per_gear": 30
            }, 
            "id": "megashift", 
            "name": "MegaShift", 
            "plan_no": 10044931
        }
    ], 
    "messages": [], 
    "status": "ok", 
    "supported_api_versions": [
        1.0, 
        1.1000000000000001
    ], 
    "type": "plans", 
    "version": "1.1"
}
Comment 2 Xiaoli Tian 2012-08-20 02:51:18 EDT
Since this is merged:
li commit : 2cfae3fa200310b2aac670f72b07d4e86c30d8bc

Move this to ON_QA to test
Comment 3 Rony Gong 2012-08-20 21:50:18 EDT
Verified on INT(devenv_2036)
[rony@localhost qsruby8]$ curl -3 -k -H "Accept: application/xml" --user "qgong@redhat.com:111111" https://int.openshift.redhat.com/broker/rest/plans
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <type>plans</type>
  <version>1.1</version>
  <messages/>
  <data>
    <plan>
      <plan-no>10044931</plan-no>
      <id>megashift</id>
      <name>MegaShift</name>
      <capabilities>
        <gear-sizes>
          <gear-size>small</gear-size>
          <gear-size>medium</gear-size>
        </gear-sizes>
        <max-gears>16</max-gears>
        <max-storage-per-gear>30</max-storage-per-gear>
      </capabilities>
    </plan>
    <plan>
      <plan-no>10044929</plan-no>
      <id>freeshift</id>
      <name>FreeShift</name>
      <capabilities>
        <gear-sizes>
          <gear-size>small</gear-size>
        </gear-sizes>
        <max-gears>3</max-gears>
      </capabilities>
    </plan>
  </data>
  <supported-api-versions>
    <supported-api-version>1.0</supported-api-version>
    <supported-api-version>1.1</supported-api-version>
  </supported-api-versions>
  <status>ok</status>
</response>
[rony@localhost qsruby8]$ curl -3 -k -H "Accept: application/json" --user "qgong@redhat.com:111111" https://int.openshift.redhat.com/broker/rest/planspython -mjson.tool
curl: option -mjson.tool: expected a proper numerical parameter
curl: try 'curl --help' or 'curl --manual' for more information
[rony@localhost qsruby8]$ curl -3 -k -H "Accept: application/json" --user "qgong@redhat.com:111111" https://int.openshift.redhat.com/broker/rest/plans|python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
120   362    0   362    0     0    230      0 --:--:--  0:00:01 --:--:--  1124
{
    "data": [
        {
            "capabilities": {
                "gear_sizes": [
                    "small", 
                    "medium"
                ], 
                "max_gears": 16, 
                "max_storage_per_gear": 30
            }, 
            "id": "megashift", 
            "name": "MegaShift", 
            "plan_no": 10044931
        }, 
        {
            "capabilities": {
                "gear_sizes": [
                    "small"
                ], 
                "max_gears": 3
            }, 
            "id": "freeshift", 
            "name": "FreeShift", 
            "plan_no": 10044929
        }
    ], 
    "messages": [], 
    "status": "ok", 
    "supported_api_versions": [
        1.0, 
        1.1000000000000001
    ], 
    "type": "plans", 
    "version": "1.1"
}

Note You need to log in before you can comment on or make changes to this bug.