Bug 868331

Summary: JBoss Tools: Unable to deal with embedded cartridges
Product: OKD Reporter: Attila Nagy <anagy>
Component: MasterAssignee: Lili Nader <lnader>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: adietish, mfisher, mshao
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: devenv_2366 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-11-06 18:49:00 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 Attila Nagy 2012-10-19 14:20:15 UTC
Description of problem: JBoss Tools Eclipse plugin cannot deal with scaling applications.


Version-Release number of selected component (if applicable): devenv_2350 (ami-7c0ab415)
Eclipse Juno + JBoss OpenShift Tools 2.4.0.Alpha2-v20121002-1453-B40 (Installed from Eclipse Marketplace)


How reproducible: Always


Steps to Reproduce:
1. Open OpenShift New Application Wizard: File -> New -> Other... -> OpenShift Application
2. Provide your access credentials
3. Add application name + application type + choose 'Enable Scaling'
4. Next -> Next -> Finish
  

Actual results: Error pop-up is shown with the following message and OpenShift Explorer doesn't show embedded cartridge haproxy (command line tools does)

Could not embed cartridges for application testingscaling
Unknow request parameter type integer


Expected results: Scaling application must be created without any errors or warnings


Additional info:

Comment 1 Attila Nagy 2012-10-19 14:21:01 UTC
Additional note: this functionality works well in production environment.

Comment 2 Attila Nagy 2012-10-19 14:34:31 UTC
Additionally the same behavior is discovered during embedding cartridges.

Steps to Reproduce #1:
1. Open OpenShift New Application Wizard: File -> New -> Other... -> OpenShift Application
2. Provide your access credentials
3. Add application name + application type + choose one of the embedded cartridges
4. Next -> Next -> Finish

Steps to Reproduce #2:
1. Open OpenShift Explorer
2. Right click on the name of the application
3. Choose menu 'Edit Embedded Cartridges...'
4. Choose one of the embedded cartridges in the list
5. Click on 'Finish'

Comment 3 Lili Nader 2012-10-19 19:05:38 UTC
I will communicate with JBoss tools team about this bug.

Comment 4 Lili Nader 2012-10-20 00:09:46 UTC
Sent email to Jboss tools team.

Comment 5 Andre Dietisheim 2012-10-20 15:08:02 UTC
There's a bug related to embedding cartridges

Comment 6 Andre Dietisheim 2012-10-20 15:09:21 UTC
Thanks for reporting this issue. This was discovered when testing Alpha2 so I dont think that this is related to the following error in Beta1 when embedding cartridges:

https://issues.jboss.org/browse/JBIDE-12864

Comment 7 Andre Dietisheim 2012-10-22 13:42:52 UTC
There's a change in the REST protocol that causes this. When we request the broker to add a cartridge to an application, the broker returns the freshly crearted (and added) resource to us. When embedding mysql, the returned json could look like this:

{
    "type" => "cartridges",
    "supported_api_versions" => [
        big decimal 1.0,
        big decimal 1.1,
        big decimal 1.2
    ],
    "data" => [{
        "type" => "embedded",
        "status_messages" => undefined,
        "name" => "mysql-5.1",
        "properties" => {
            "username" => "admin",
            "connection_url" => "mysql://127.0.252.129:3306/",
            "info" => "Connection URL: mysql://127.0.252.129:3306/",
            "database_name" => "ba",
            "password" => "ruWyzLFih2b2"
        },
        "links" => {
            "DELETE" => {
            ...



Now the latest REST protocol apparently returns a link for an UPDATE action which holds optional parameters of type <b>"integer"</b>:

            "UPDATE" => {
                "href" => "https://ec2-107-20-102-82.compute-1.amazonaws.com/broker/rest/domains/somedomain/applications/ba/cartridges/mysql-5.1",
                "required_params" => [],
                "method" => "PUT",
                "optional_params" => [
                    {
                        "name" => "additional_storage",
                        "type" => "integer",
                        ...
                    },
                    {
                        "name" => "scales_from",
                        "type" => "integer",
                        ...
                    },
                    {
                        "name" => "scales_to",
                        "type" => "integer",
                        ...
                    }
                ],
                "rel" => "Update cartridge configuration"
            }


These new type make the openshift-java-client fail in the unmarshalling since it's only aware of String and Boolean types so far. 
I'd ask you to push this change to protocol 1.1 and up since you'd otherwise break our existing clients (JBoss Tools, etc.).

Comment 9 Lili Nader 2012-10-23 22:00:25 UTC
fixed in devenv_2366

Comment 10 Andre Dietisheim 2012-10-24 07:40:32 UTC
@Lili: so what did you exactly fix? I'd appreciate some comments.

Comment 11 Andre Dietisheim 2012-10-24 08:23:39 UTC
so in https://github.com/lnader/origin-server/commit/73ce66d14930631f65b790bf0d5687514b7fa54e you apparently removed the integer link parameters for rest proto 1.0 (proto 1.1 in https://github.com/lnader/origin-server/blob/master/controller/lib/openshift-origin-controller/app/models/rest_cartridge11.rb still has them). 
So that would mean that the latest OpenShift would - in prot 1.0 - not provide the integer parameters and break the openshift-java-client, right?

Comment 12 Attila Nagy 2012-10-24 14:07:45 UTC
Verified against devenv_2372