Bug 1003014 - Cartridge name issue
Cartridge name issue
Product: OpenShift Online
Classification: Red Hat
Component: Pod (Show other bugs)
Unspecified Unspecified
unspecified Severity high
: ---
: ---
Assigned To: Rajat Chopra
libra bugs
Depends On:
  Show dependency treegraph
Reported: 2013-08-30 09:39 EDT by Fenix Steffel
Modified: 2015-05-14 20:20 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-09-19 12:48:43 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Fenix Steffel 2013-08-30 09:39:39 EDT
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 11:23:28 EDT
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 13:29:22 EDT
Haven't had the chance to look into this completely. Could you please take a look?
Comment 3 Rajat Chopra 2013-09-10 21:05:34 EDT
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 : 
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-11 23:03:02 EDT
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 05:30:20 EDT
Please ignore comment 4, looks like the Cartridge-Short-Name I used is incorrect, the actual cartridge has been provided.

Comment 7 Rajat Chopra 2013-09-12 14:57:11 EDT
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 17:18:52 EDT
**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-12 22:05:02 EDT
Verified on devenv_3780

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

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

Note You need to log in before you can comment on or make changes to this bug.