Bug 962657

Summary: The RESULT content is not consistent when adding db cartridges which makes website can not display username and password when adding mongodb.
Product: OpenShift Online Reporter: Yujie Zhang <yujzhang>
Component: ContainersAssignee: Dan Mace <dmace>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: dmace, 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:03:26 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 Yujie Zhang 2013-05-14 07:41:53 UTC
Description of problem:

Create an application using rhc and add mysql cartridge, then add postgresql cartridge, found that the result content is not consistent, for the result content when adding postgresql miss username and password, so there is no username and password info return when adding postgresql from website.

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

How reproducible:
always

Steps to Reproduce:
1.Create an application and add mysql cartridge using rhc
2.Add postgresql cartridge using rhc
3.Add postgresql catridge using website
  
Actual results:

The result content is as following when adding mysql cartridge:

testapp @ http://testapp-testnamespace.dev.rhcloud.com/
  (uuid: 5191dfdc602cec0766000001)
-------------------------------------------------------
  Created: 2:55 PM
  Gears:   1 (defaults to small)
  Git URL: ssh://5191dfdc602cec0766000001.rhcloud.com/~/git/testapp.git/
  SSH:     5191dfdc602cec0766000001.rhcloud.com

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

  mysql-5.1 (MySQL Database 5.1)
  ------------------------------
    Gears:          Located with php-5.3
    Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/
    Database Name:  testapp
    Password:       Ajt5aUcDN-aN
    Username:       adminCVXJJi9

RESULT:
Application testapp was created.
MySQL 5.1 database added.  Please make note of these credentials:
       Root User: adminCVXJJi9
   Root Password: Ajt5aUcDN-aN
   Database Name: testapp
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.

The result content is as following when adding postgresql:

testapp2 @ http://testapp2-testnamespace.dev.rhcloud.com/
  (uuid: 662209908578744923062272)
---------------------------------------------------------
  Created: 2:57 PM
  Gears:   1 (defaults to small)
  Git URL: ssh://662209908578744923062272.rhcloud.com/~/git/testapp2.git/
  SSH:     662209908578744923062272.rhcloud.com

  php-5.3 (PHP 5.3)
  -----------------
    Gears: Located with postgresql-8.4

  postgresql-8.4 (PostgreSQL Database 8.4)
  ----------------------------------------
    Gears:          Located with php-5.3
    Connection URL: postgresql://$OPENSHIFT_POSTGRESQL_DB_HOST:$OPENSHIFT_POSTGRESQL_DB_PORT
    Database Name:  testapp2
    Password:       PdlzXFl7FJ4t
    Username:       adminaagjtin

RESULT:
Application testapp2 was created.
Connection URL:
postgresql://$OPENSHIFT_POSTGRESQL_DB_HOST:$OPENSHIFT_POSTGRESQL_DB_PORT

Expected results:

The RESULT content should be consistent when adding db catridges, and adding postgresql from website should return username and password.

Additional info:

Comment 1 Jhon Honce 2013-05-14 16:09:49 UTC
Are you saying when using the web interface you do not see the second databases credentials?

Comment 2 Yujie Zhang 2013-05-15 00:22:56 UTC
Yes,there is no username and password of database after adding postgresql from website.

Comment 3 Jhon Honce 2013-05-16 00:24:29 UTC
Since the rhc commands provide the expected output, I believe this is a website issue rather than a node issue.

Comment 4 Clayton Coleman 2013-05-23 17:12:42 UTC
This is the values the REST API returns to us.

Comment 5 Lili Nader 2013-05-24 18:17:54 UTC
The client only displays what gets returned from node as "CLIENT_RESULT".  In case of postgres only connection URL is returned and needs to be fixed in the cartridge.

Returned from postgres cartridge
CLIENT_RESULT: Connection URL: postgresql://$OPENSHIFT_POSTGRESQL_DB_HOST:$OPENSHIFT_POSTGRESQL_DB_PORT


Returned from mysql cartridge
CLIENT_RESULT: MySQL 5.1 database added.  Please make note of these credentials:
CLIENT_RESULT:    Root User: [HIDDEN]
CLIENT_RESULT:    Root Password: [HIDDEN]
CLIENT_RESULT:    Database Name: app
CLIENT_RESULT: Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/
CLIENT_RESULT: You can manage your new MySQL database by also embedding phpmyadmin-3.4.
CLIENT_RESULT: The phpmyadmin username and password will be the same as the MySQL credentials above.

Comment 6 Dan Mace 2013-05-24 21:31:47 UTC
Fotios:

The postgresql install script needs the following:

client_result ""
client_result "PostgreSQL ${version} database added.  Please make note of these credentials:"
client_result ""
client_result "   Root User: ${username}"
client_result "   Root Password: ${password}"
client_result ""
client_result "Connection URL: ${conn_url}"
client_result ""

During the course of testing this, I noticed the initial postgres db is now coming from a statically built tarball. However, the expectation is that the initial database name will follow the app name; I see no code in install to account for this, and using `psql` from a shell in the new gear errors as it expects to connect to a database name matching the app name.

Please address both the credential reporting with client_result entries and also fix the database naming as part of this issue (ensuring to also report the database name in the client_result entries).

Comment 8 Dan Mace 2013-05-25 11:32:08 UTC
Fotios: I found the database setup code I had missed before, and corrected the remaining client_result issue.

Comment 9 openshift-github-bot 2013-05-25 12:49:09 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/6ddaff5ce1c41d4a7f452727097ea7cae1834b26
Bug 962657: Return db info to client during postgres install

Comment 10 Yujie Zhang 2013-05-27 10:22:48 UTC
Tested on devenv_3277, it can display username and password when adding postgresql and mysql, but can not display username and password of mongodb this time, could you please help to check again?Thanks!

Comment 12 openshift-github-bot 2013-05-28 16:14:18 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/5ab6507853f67e15098e4a22cc9c8282c34ee2cd
Bug 962657: Add client result for mongodb credentials during install

Comment 14 Yujie Zhang 2013-05-29 06:59:44 UTC
Tested on devenv_3282, the there is username and password when adding mysql,postgresql and mongo db to application, so verify this bug, thanks.