Bug 1100508 - Application types list has "JBoss Enterprise Application Platform 6" under "Other types" instead of under "Java"
Summary: Application types list has "JBoss Enterprise Application Platform 6" under "O...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: Management Console
Version: 2.x
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Clayton Coleman
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks: 1100507
TreeView+ depends on / blocked
 
Reported: 2014-05-23 00:24 UTC by Miciah Dashiel Butler Masters
Modified: 2015-05-15 01:35 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1100507
Environment:
Last Closed: 2014-07-15 10:27:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Miciah Dashiel Butler Masters 2014-05-23 00:24:02 UTC
PR: https://github.com/openshift/origin-server/pull/5442

+++ This bug was initially created as a clone of Bug #1100507 +++

Description of problem:

In the application types list in the management console (/console/application_types), the "JBoss Enterprise Application Platform 6" (jbosseap-6) cartridge is placed in the "Other types" group instead of in the "Java" group.


How reproducible:

Readily.


Steps to Reproduce:

1. Provision a RHEL6 host.

2. Run `curl -O https://raw.githubusercontent.com/openshift/openshift-extras/enterprise-2.1/enterprise/install-scripts/generic/openshift.sh` on the RHEL6 host provisioned in Step 1 to get the latest version of the installation script.

3. Run `sh openshift.sh` on the RHEL6 host to install OpenShift Enterprise 2.1 with the standard cartridges.

4. Run `sh openshift.sh actions=post_deploy` to perform post-deployment configuration on the RHEL6 host.

5. On a system with a web browser, browse to the URL https://broker.example.com/console/application_types where either the system is configured to resolve broker.example.com to the host provisioned in Step 1 or broker.example.com is substituted in the URL by the IP address of the host.


Actual results:

"JBoss Enterprise Application Platform 6" appears under the "Other types" category.


Expected results:

"JBoss Enterprise Application Platform 6" should appear under the "Java" category.


Additional info:

The relevant code is the algorithm in_groups_by_tag in Console::ModelHelper:   https://github.com/openshift/enterprise-server/blob/enterprise-2.1/console/app/helpers/console/model_helper.rb#L257

The algorithm takes a list of application types and tags and returns two arrays: one with the application types grouped tags that they match and one with application types that have no tags that more than one application type matches.    https://github.com/openshift/enterprise-server/blob/enterprise-2.1/console/app/controllers/application_types_controller.rb#L42

The algorithm iterates over the array of tags that is passed into it.  For each tag in this array, the algorithm pulls out each type that matches the tag.  After iterating over the array of types while matching them against the iterator tag, the algorithm either creates a new grouping of all types that matched the tag if there were more than one, or else the algorithm puts any matching type in the "other" group.

The problem is that jbosseap-6 has the "xpaas" tag, which comes before the "java" tag in the array of tags provided to in_groups_by_tag.  Thus the jbosseap-6 cartridge is found to match the "xpaas" tag before the "java" tag is considered.  However, jbosseap-6 is the only cartridge with the "xpaas" tag, so it is placed on the "other" group before the "java" tag is considered.  Thus by the time the "java" tag is considered, jbosseap-6 has already been pulled into the "others" group and is not in the array considered for consideration when matching types against the "java" tag.

Comment 1 openshift-github-bot 2014-05-30 20:44:03 UTC
Commits pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/0cd99f80d6d35ac77d4c44df552f478d5a547e77
Console: Improve grouping of application types

Improve the algorithm Console::ModelHelper#in_groups_by_tag to consider
application types for grouping under a tag even for a type that has
previously matched a tag that had only one match.

in_groups_by_tag takes a list of application types and tags and returns two
arrays: One with the application types grouped tags that they match and one
with application types that have no tags that more than one application
type matches.

The algorithm iterates over the array of tags that is passed into it.  For
each tag in this array, the algorithm pulls out each type that matches the
tag.  After iterating over the array of types while matching them against
the iterator tag, the algorithm either creates a new grouping of all types
that matched the tag if there were more than one, or else the algorithm
puts any matching type in the "other" group.

The problem is that jbosseap-6 has the "xpaas" tag, which comes before the
"java" tag in the array of tags provided to in_groups_by_tag.  Thus the
jbosseap-6 cartridge is found to match the "xpaas" tag before the "java"
tag is considered.  However, jbosseap-6 is the only cartridge with the
"xpaas" tag, so it is placed on the "other" group before the "java" tag is
considered.  Thus by the time the "java" tag is considered, jbosseap-6 has
already been pulled into the "others" group and is not in the array
considered for consideration when matching types against the "java" tag.

This commit changes the algorithm instead to leave types in the array of
types for consideration for matching against tags until that type is found
to be one of multiple types that match some tag.

This commit fixes bug 1100508.

https://github.com/openshift/origin-server/commit/df525b4e32edb7eba69e1583a603c2414ee058f7
model_helper_tests.rb: Add test for bug 1100508

Comment 2 Yujie Zhang 2014-06-11 08:28:18 UTC
Merged the code to an old enterprise env, and it works, the jbosseap-6 can be listed in the 'java' column, so verify this bug, thanks.


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