Bug 848956

Summary: Rest api for list plans via XML is not working
Product: OKD Reporter: Chandrika Gole <cgole>
Component: MasterAssignee: Lili Nader <lnader>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: bmeng, mfisher, mshao, qgong, xtian
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-09-17 21:29:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Chandrika Gole 2012-08-16 22:46:54 UTC
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" 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-17 02:58:01 UTC
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: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 06:51:18 UTC
Since this is merged:
li commit : 2cfae3fa200310b2aac670f72b07d4e86c30d8bc

Move this to ON_QA to test

Comment 3 Rony Gong 🔥 2012-08-21 01:50:18 UTC
Verified on INT(devenv_2036)
[rony@localhost qsruby8]$ curl -3 -k -H "Accept: application/xml" --user "qgong: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: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: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"
}