Bug 838611

Summary: JBoss Tools Plugin: Error message during removing an embedded cartridge
Product: OKD Reporter: Attila Nagy <anagy>
Component: MasterAssignee: Krishna Raman <kraman>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: abhgupta, adietish, admiller, mfisher, mshao, rmillner
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 911322 (view as bug list) Environment:
Last Closed: 2012-07-13 23:43:23 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:
Attachments:
Description Flags
full response none

Description Attila Nagy 2012-07-09 15:25:37 UTC
Description of problem: Using JBoss Tools plugin adding / removing embedded cartridges produces a strange error-message.

Could not embed cartridges for application myphptestapp
Could not find link "DELETE" in resource "EmbeddedCartridgeResource"


Version-Release number of selected component (if applicable):\
devenv_1879 (ami-63228e0a)
Eclipse Juno
JBoss OpenShift Tools - 2.3.0.v20120613-1951-H135-Final	(installed from Eclipse Marketplace)


How reproducible: Always


Steps to Reproduce:
1. Create an OpenShift Application or import an existing one in Eclipse
2. Open OpenShift Explorer
3. Right click on the application name and select 'Edit Embedded Cartridges'
  

Actual results: The error-message above is shown. At the second attempt the cartridge will be added successfully. Removing an already embedded cartridge produces the same issue; the error-message above is shown, but actually the embedded cartridge is successfully removed.


Expected results: Adding / removing embedded cartridge must be successfully.


Additional info: On current production environment this feature works well without strange error-messages.

Comment 1 Abhishek Gupta 2012-07-09 19:21:07 UTC
Note: I need more information on what, if anything, needs to be changed/fixed on the backend side.

The REST API does return the 'DELETE' link for the cartridge, whether one is querying for a single cartridge or the entire list of cartridges. The links are also returned when the cartridge structure is returned at the time of embedding it in the application. I have pasted below the link structure for both json and xml. 


"DELETE":{"required_params":[],"optional_params":[],"rel":"Delete embedded cartridge","method":"DELETE","href":"https://localhost/broker/rest/domains/agupta130/applications/app1/cartridges/mysql-5.1"}


<link>
  <required-params/>
  <rel>Delete embedded cartridge</rel>
  <optional-params/>
  <method>DELETE</method>
  <href>https://localhost/broker/rest/domains/agupta130/applications/app1/cartridges/mysql-5.1</href>
</link>

Comment 2 Abhishek Gupta 2012-07-09 19:22:49 UTC
Max Anderson: Can you please look into this bug and comment?

Comment 3 Lili Nader 2012-07-09 22:19:14 UTC
I sent email to JBoss tools team to take a look at this bug.

Comment 4 Attila Nagy 2012-07-11 08:55:56 UTC
From broker log:

Started GET "/broker/rest/domains/myd2012071101/applications/redmine2/cartridges" for 209.132.186.34 at Wed Jul 11 04:25:39 -0400 2012
  Processing by EmbCartController#index as JSON
  Parameters: {"application_id"=>"redmine2", "domain_id"=>"myd2012071101"}
MongoDataStore.find(CloudUser, anagy+2012071101, anagy+2012071101)

Getting cartridges for application redmine2 under domain myd2012071101
[REQ_ID=cceaccc552b64786a79d369826d19e43] ACTION=LIST_APP_CARTRIDGES Listing cartridges for application redmine2 under domain myd2012071101
Completed 200 OK in 60ms (Views: 17.4ms)

In the response I could find a link about deletion.

...
<links>
        <link>
          <href>https://ec2-23-22-173-85.compute-1.amazonaws.com/broker/rest/domains/myd2012071101/applications/redmine2/cartridges/mysql-5.1</href>
          <optional-params/>
          <rel>Delete embedded cartridge</rel>
          <method>DELETE</method>
          <required-params/>
        </link>
...

I'll attached the full response in XML format.

Comment 5 Attila Nagy 2012-07-11 08:56:48 UTC
Created attachment 597508 [details]
full response

Comment 6 Andre Dietisheim 2012-07-11 14:45:50 UTC
I could track the problem down to a semantical change in the REST responses in the latest DEVENV:

if you request the embedded cartridges for a given app, you'll get the application type, too, which is not the case in PROD now.

Example:

I have an application "tata" with no embedded cartridges running on my DEVENV:

{
    ...
    "name" => "tata",
    ...
    "framework" => "jbossas-7",
    ...
}

If I request it's embedded cartridges, I'll GET the following link and get the list of embedded cartridges:

       "LIST_CARTRIDGES" => {
            "href" => "https://ec2-23-22-173-85.compute-1.amazonaws.com/broker/rest/domains/holymoly/applications/tata/cartridges",
            "optional_params" => [],
            "rel" => "List embedded cartridges",
            "method" => "GET",
            "required_params" => []
        },

In PROD, I'll get an empty list. In my DEVENV, I get a list with a single entry, the appliction type (cartridge):

{
   "type":"cartridges",
   "status":"ok",
   ...
   "data":[
      {
      ...
         "name":"jbossas-7",
         "type":"standalone",
         ...

On the other hand, if we request the available embeddable cartridges on the API resource, we'll only get the embeddable cartridges, no application type (cartridges).

There's no problem for us to handle this change, but we can't do that for our existing userbase. They would be stuck in a Eclipse tooling that is not able to add/remove cartridges. We'd have to update their client. 

IMHO with this change in place you'd have to bump up the protocol version and make sure our userbase would still get the prior protocol. I double checked, we still send "Accept: application/json; version=1.0".

Comment 7 Krishna Raman 2012-07-11 21:57:37 UTC
https://github.com/openshift/crankcase/pull/224

Comment 8 Adam Miller 2012-07-12 00:33:28 UTC
Merged.

Comment 9 Attila Nagy 2012-07-12 12:13:14 UTC
Verified against ami-ab72ddc2.