Bug 970008

Summary: Account can't be connected after adding a downloadable cartridge if the app already has a same addon cartridge added previously
Product: OpenShift Online Reporter: joycezhang <jinzhang>
Component: PodAssignee: Abhishek Gupta <abhgupta>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.xCC: abhgupta, dmcphers, jhou, jinzhang, jliggitt, rchopra, xtian
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-11 04:15:57 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 joycezhang 2013-06-03 10:06:34 UTC
Description of problem:
If try to use rhc domain show -l jinzhang+1, it would be failed to get apps as below:

# rhc domain show -l jinzhang+1 --server stg.openshift.redhat.com
The server did not respond correctly. This may be an issue with the server configuration or with your connection to the server (such as a Web proxy or firewall). Please verify that you
can access the OpenShift server https://stg.openshift.redhat.com/broker/rest/domains/stgtest1/applications


Version-Release number of selected component (if applicable):
STG(devenv-stage_356)

How reproducible:
always

Steps to Reproduce:
1.rhc domain show -l jinzhang+6

Actual results:
Error is shown from rhc, but it can be connected from web console. 

Expected results:
All apps are returned without error.

Additional info:
It didn't consume all gears as below:
 rhc account -l jinzhang+1 --server stg.openshift.redhat.com
Server:                     stg.openshift.redhat.com
Login:                      jinzhang+1
Plan:                       Silver
Gears Used:                 20
Gears Allowed:              30
Allowed Gear Sizes:         small, medium
SSL Certificates Supported: yes

Comment 2 Jordan Liggitt 2013-06-03 12:25:15 UTC
Enabling HTTP_DEBUG=1, this is the request that breaks:

GET /broker/rest/domains/stgtest1/applications?include=cartridges HTTP/1.1
accept: application/json;version=1.4
authorization: Bearer ...
User-Agent: rhc/1.10.1 (ruby 1.9.3; x86_64-linux) (2.3.3, ruby 1.9.3 (2013-05-15))
Date: Mon, 03 Jun 2013 12:22:11 GMT
Host: stg.openshift.redhat.com



= Response

HTTP/1.1 500 
Date: Mon, 03 Jun 2013 12:22:11 GMT
Server: Apache/2.2.15 (Red Hat)
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.17
X-Request-Id: abc11d4c9a9cc34121d788bf6bdd8b3a
X-Runtime: 0.307087
Cache-Control: private
X-Rack-Cache: miss
Content-Length: 728
Status: 500
Content-Type: text/html; charset=utf-8
Strict-Transport-Security: max-age=15768000, includeSubDomains
Vary: Accept-Encoding,User-Agent
ProxyTime: D=318328
Connection: close

Comment 3 Abhishek Gupta 2013-06-03 17:35:51 UTC
We need to ensure that this is not the same issue as bug 968254. 

In case of bug 968254, one of the application was created using a community cartridge before a fix went in related to cartridge vendor name handling. The resolution in that case was to re-create the application and things worked just fine. 

The issue is with the component_name that is stored in mongo. In that application, it did not include the cartridge_vendor name. To verify if this is the same issue, please get the mongo dump of the applications within the domain and check whether the component_name attribute has the cartridge vendor name appended to it. 

This applies to apps with community cartridges in them and hence no migration script is provided since production does not have any applications with community carts.

Comment 4 Dan McPherson 2013-06-03 18:17:05 UTC
@Abhishek, 968254 never existed in stage.

Comment 5 Rajat Chopra 2013-06-03 23:47:00 UTC
The issue is an apparent addition of two similar cartridges with different vendor information being added to an application.

1. Create an app and add mysql to it
2. To the app, add a downloadable cartridge that provides mysql (e.g. wsun-mysql-5.1)
3. Try to do rhc domain show and it will show similar symptoms as above.

Fixed this problem with rev#152beec9118e4d1

Now step#2 will not succeed and will not spoil the app.
For the current app, it must be deleted and recreated - no other option unless a manual cleanup of mongo is undertaken.

Comment 6 joycezhang 2013-06-04 08:01:02 UTC
Tested on STG(devenv-stage_357), an error message will be shown to prevent adding a downloadable cartridge if the app already has a same addon cartridge added previously as below:

# rhc cartridge add https://raw.github.com/jhou1/v2mysql/master/metadata/manifest.yml  -a php1 -l jinzhang+2 -p redhatThe cartridge 'https://raw.github.com/jhou1/v2mysql/master/metadata/manifest.yml' will be downloaded and installed
Adding https://raw.github.com/jhou1/v2mysql/master/metadata/manifest.yml to application 'php1' ... mysql is already an embedded feature in the application

Comment 7 joycezhang 2013-06-04 08:21:18 UTC
If trying to add a downloadable cartridge firstly, and then add a similar cartridge, it would be different as below:

1. Create an app and add a downloadable cartridge:
# rhc cartridge add https://raw.github.com/jhou1/v2mysql/master/metadata/manifest.yml  -a php1 -l jinzhang+2 -p redhat
The cartridge 'https://raw.github.com/jhou1/v2mysql/master/metadata/manifest.yml' will be downloaded and installed
Adding https://raw.github.com/jhou1/v2mysql/master/metadata/manifest.yml to application 'php1' ... Success

jhou-mysql-5.1 (MySQL Database 5.1)
-----------------------------------
  From:           https://raw.github.com/jhou1/v2mysql/master/metadata/manifest.yml
  Gears:          Located with php-5.3, openshift-downloadable-mock-plugin-0.1
  Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/
  Database Name:  php1
  Password:       BMmv-1bTMwe3
  Username:       adminRYP2qi6

RESULT:
Added jhou-mysql-5.1 to application php1
MySQL 5.1 database added.  Please make note of these credentials:
       Root User: adminRYP2qi6
   Root Password: BMmv-1bTMwe3
   Database Name: php1
Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/
You can manage your new MySQL database by also embedding phpmyadmin-3.4.
The phpmyadmin username and password will be the same as the MySQL credentials above.


2. Add a similiar addon cartridge, it will use the added downloadable cartridge as below
# rhc cartridge add mysql-5.1  -a php1 -l jinzhang+2 -p redhat
Adding mysql-5.1 to application 'php1' ... Success

jhou-mysql-5.1 (MySQL Database 5.1)
-----------------------------------
  From:           https://raw.github.com/jhou1/v2mysql/master/metadata/manifest.yml
  Gears:          Located with php-5.3, openshift-downloadable-mock-plugin-0.1
  Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/
  Database Name:  php1
  Password:       BMmv-1bTMwe3
  Username:       adminRYP2qi6

RESULT:
Added mysql-5.1 to application php1


# rhc domain show -l jinzhang+2 -p redhat
Applications in teststg23 domain
--------------------------------

  php1 @ http://php1-teststg23.stg.rhcloud.com/ (uuid: 51ad9abe2587c844670001b8)
  ------------------------------------------------------------------------------
    Created: 3:43 PM
    Gears:   1 (defaults to small)
    Git URL: ssh://51ad9abe2587c844670001b8.rhcloud.com/~/git/php1.git/
    SSH:     51ad9abe2587c844670001b8.rhcloud.com

    php-5.3 (PHP 5.3)
    -----------------
      Gears: Located with jhou-mysql-5.1

    jhou-mysql-5.1 (MySQL Database 5.1)
    -----------------------------------
      From:           https://raw.github.com/jhou1/v2mysql/master/metadata/manifest.yml
      Gears:          Located with php-5.3, openshift-downloadable-mock-plugin-0.1
      Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/
      Database Name:  php1
      Password:       BMmv-1bTMwe3
      Username:       adminRYP2qi6


It will always be successfull when adding mysql-5.1 to this app, and only the downloadable cartridge will be returned as above.  Could you please help confirm if it works as design?


Thanks.