Bug 1003014

Summary: Cartridge name issue
Product: OpenShift Online Reporter: Fenix Steffel <steffel.fenix>
Component: PodAssignee: Rajat Chopra <rchopra>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 2.xCC: ccoleman, jhou
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-09-19 16:48:43 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 Fenix Steffel 2013-08-30 13:39:39 UTC
Description of problem:

Installing two cartridge with same Name but different Cartridge-Short-Name leads to an error, and the console cheked.

This should be prevented at creation/install time of the cart. 

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


How reproducible:

Steps to Reproduce:
1.Create two cartridges with a mistake, ex:
Name: app1
Cartridge-Short-Name: APP1
 
 
Name: app1
Cartridge-Short-Name: APP2

2. Install the wrong one
3. Install the other

Actual results:

Install run and crash, console choked

Expected results:

Checking thats nameare different and prevent from install.

Additional info:

Comment 1 Clayton Coleman 2013-08-30 15:23:28 UTC
The broker should not allow downloadable cartridges to be installed where Name.downcase != Cartridge-Short-Name.downcase.  Or if the node is validating, the node should result in an error.

This breaks the REST API (cartridge not found) in a way that means the REST API is disabled, so high severity.

Comment 2 Abhishek Gupta 2013-09-09 17:29:22 UTC
Haven't had the chance to look into this completely. Could you please take a look?

Comment 3 Rajat Chopra 2013-09-11 01:05:34 UTC
The names can actually be different. No issues. The 'name' is used to refer to the cartridge for controlling it, while cartridge-short-name is used by the node to set the ENV variables.

e.g. with this example :
Name: app1
Cartridge-Short-Name: APP2

expect that cartridge will be installed in something like : 
/var/lib/5128238ab23923982c92f/app1/
while the env variable to point to that dir will be called OPENSHIFT_APP2_DIR


Not sure what the steps to the problem you faced. Please share the actual cartridges, if its not an issue.

Comment 4 Jianwei Hou 2013-09-12 03:03:02 UTC
Hi, Fenix Steffel: I'm not sure my steps are same as yours, please correct me if necessary, here is my findings:

Create two applications with 2 cartridges, the cartridges have same 'Name' but different 'Cartridge-Short-name', could refer to https://raw.github.com/jhou1/openshift-custom-perl/master/metadata/manifest.yml and https://raw.github.com/jhou1/openshift-custom-perl1/master/metadata/manifest.yml

When the 2nd app is being created with the 2nd cartridge, my cli shows "/var/lib/openshift/52312cdc6849bb57700000f7/v2perl/bin/setup: line 10: OPENSHIFT_PERL_DIR: unbound variable" and fails.

It will help a lot if you could share your actual cartridges. I'm assigning this back to see if this needs further fix, thanks.

Comment 6 Jianwei Hou 2013-09-12 09:30:20 UTC
Please ignore comment 4, looks like the Cartridge-Short-Name I used is incorrect, the actual cartridge has been provided.

https://raw.github.com/worldline/openshift-geoserver-cartridge/master/metadata/manifest.yml

Comment 7 Rajat Chopra 2013-09-12 18:57:11 UTC
The geoserver cartridge has other things missing in it, so I could not see the exact problem.
However, I found one issue with the code and that is related to 'Name' of cartridge not being in the 'Categories', and possibly that caused the error seen in this case.

Fix provided in https://github.com/openshift/origin-server/pull/3631


For testing :
1. Create an app
2. Embed a downloadable cartridge e.g. https://raw.github.com/rajatchopra/openshift-origin-cartridge-cassandra/master/metadata/manifest.yml
3. Embed another downloadable cartridge with modified manifest (e.g. a modified mysql/mongo/redis cartridge). Change the manifest such that the Name is 'cassandra' again. Ensure that 'cassandra' does not exist in the Categories of this second cartridge.
You can use this for above : https://raw.github.com/smarterclayton/openshift-redis-cart/master/metadata/manifest.yml  (just serve the manifest from somewhere else after modifying the Name to cassandra)

Before fix: 
Error in second install - 
Invalid cartridge. Valid values are (mock-plugin-0.1, cron-1.4, phpmyadmin-4, rockmongo-1.1, switchyard-0, metrics-0.1, 10gen-mms-agent-0.1,mysql-5.1, haproxy-1.4, postgresql-9.2, postgresql-8.4, mongodb-2.2, jenkins-client-1)

Also the app will become useless with respect to managing the first 'cassandra' cart install. This app is gone, only destroy can happen.

After fix:
Error in second install -
cassandra is already an embedded feature in the application

The second app is prevented from being installed.


@jhou : As a side note, the issue with your perl cartridge is the Cartridge-Short-Name. It should be PERL and V2PERL, because thats what the setup script is expecting. Thats why you get OPENSHIFT_PERL_DIR: unbound variable. Check comment#3. HTH.

Comment 8 Rajat Chopra 2013-09-12 21:18:52 UTC
**Note : in the previous comment (comment#7) - s/Categories/Provides/g
The Name may not exist in Provides (nothing to do with Categories here).
Sorry for the confusion.

Comment 9 Jianwei Hou 2013-09-13 02:05:02 UTC
Verified on devenv_3780

Steps:
1. Create an app
2. Embed a downloadable cartridge e.g. https://raw.github.com/rajatchopra/openshift-origin-cartridge-cassandra/master/metadata/manifest.yml
3. Embed another downloadable cartridge https://raw.github.com/jhou1/openshift-redis-cart/master/metadata/manifest.yml

Result:
Adding https://raw.github.com/jhou1/openshift-redis-cart/master/metadata/manifest.yml to application 'd1' ... cassandra is already an embedded feature in the application