Bug 1170784 - Upgrade from OSE 2.1->2.2 will not set the OPENSHIFT_MYSQL_VERSION environment variable for mysql gears.
Summary: Upgrade from OSE 2.1->2.2 will not set the OPENSHIFT_MYSQL_VERSION environmen...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: ImageStreams
Version: 2.2.0
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: ---
Assignee: Brenton Leanhardt
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-04 20:41 UTC by Brenton Leanhardt
Modified: 2015-01-08 15:34 UTC (History)
6 users (show)

Fixed In Version: openshift-origin-cartridge-mysql-1.29.3.1-1
Doc Type: Bug Fix
Doc Text:
Cause: OPENSHIFT_MYSQL_VERSION was not set during mysql cartridge updates in all cases. Consequence: Gears wishing to make use of OPENSHIFT_MYSQL_VERSION may not have the expected value. Fix: OPENSHIFT_MYSQL_VERSION is now set in all cases. Result: OPENSHIFT_MYSQL_VERSION now contains the expected value.
Clone Of:
Environment:
Last Closed: 2015-01-08 15:34:40 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:0019 0 normal SHIPPED_LIVE Red Hat OpenShift Enterprise 2.2.3 bug fix and enhancement update 2015-01-08 20:33:24 UTC

Description Brenton Leanhardt 2014-12-04 20:41:56 UTC
Description of problem:

While looking in to merging upstream sprint 54 in to OSE 2.2 I noticed the following code in the mysql cartridge upgrade script:

if [[ $new_cart_version == "0.2.16" ]]; then
  set_env_var 'OPENSHIFT_MYSQL_VERSION' $mysql_version $env_dir
fi

The problem with that is that OSE 2.1 never shipped 0.2.16 and OSE 2.2 shipped 0.2.17.  As part of the OSE 2.1->2.2 upgrade process gears will go from whatever OSE 2.1 cartridge version was installed directly to 0.2.17.  That means that if statement will never be true for OSE.

I'm planning to fix this by changing the code to something like this:

if version_lt $curr $SPRINT_54; then
  if [[ ! -f ${OPENSHIFT_MYSQL_DIR}/env/OPENSHIFT_MYSQL_VERSION ]]; then
    # There is now a VERSION variable to allow the detection of 5.5
    # in rhcsh.
    set_env_var 'OPENSHIFT_MYSQL_VERSION' $mysql_version "${OPENSHIFT_MYSQL_DIR}/env"
  fi
fi

Technically it's safe to run set_env_var over again but I thought this shows our intention of only touching gears that have the problem.  This will of course be a compatible upgrade.

Comment 1 Brenton Leanhardt 2014-12-04 20:43:32 UTC
For QE, please qa_ack this bug if you can verify that the 2.1->2.2 upgrade doesn't indeed fail to create this environment variable.

Comment 4 Ma xiaoqiang 2014-12-09 08:45:06 UTC
Check on puddle [2.2.z/2014-12-08.2]

1. install the env for ose-2.1
2. create apps 
#rhc app create phps php-5.4 mysql-5.1 -s
#rhc app create phpapp php-5.4 mysql-5.5 
3. Check the env in the mysql gears
There is no 'OPENSHIFT_MYSQL_VERSION' env
4. Upgrade the env
5. Check the env in the mysql gears
[5486983b87692b817500000a-xiaom.ose-21.com.cn 5486983b87692b817500000a]\> env|grep -i mysq;
<--snip-->
OPENSHIFT_MYSQL_VERSION=5.1
[phpapp-xiaom.ose-21.com.cn 5486987087692bcb59000001]\> env|grep -i mysql
<--snip-->
OPENSHIFT_MYSQL_VERSION=5.5

Comment 6 errata-xmlrpc 2015-01-08 15:34:40 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0019.html


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