Bug 1045005 - OPENSHIFT_POSTGRESQL_VERSION env var is not added after upgrade env from 1.2 to 2.0
Summary: OPENSHIFT_POSTGRESQL_VERSION env var is not added after upgrade env from 1.2 ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Cluster Version Operator
Version: 1.2.1
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Jason DeTiberus
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-12-19 12:38 UTC by Johnny Liu
Modified: 2014-02-04 14:51 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-02-04 14:51:39 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Johnny Liu 2013-12-19 12:38:39 UTC
Description of problem:
After upgrade env from 1.2 to 2.0, log into app, run "pqsl", a bash error is seen:
[scapythonapp-jialiu.rhn.com ~]\> psql
bash: [: =: unary operator expected
psql (8.4.18)
Type "help" for help.


That is because in /var/lib/openshift/<uuid>/.env/postgresql/, OPENSHIFT_POSTGRESQL_VERSION env var is not added after upgrade 1.2 to 2.0.

But in rhcsh, this var is read by psql function.
function psql() {
  ...
  if [ $OPENSHIFT_POSTGRESQL_VERSION = '9.2' ]; then
    which scl 2>&1 >/dev/null
    if [ $? -eq 0 ]; then
      CMD=`scl enable postgresql92 "which psql"`
    fi
  fi
  ...


Version-Release number of selected component (if applicable):
openshift-enterprise-release-2.0.0c-1.git.21.e364d06.el6op.noarch
openshift-enterprise-upgrade-node-2.0.0c-1.git.21.e364d06.el6op.noarch
openshift-enterprise-upgrade-broker-2.0.0c-1.git.21.e364d06.el6op.noarch
openshift-enterprise-yum-validator-2.0.0c-1.git.21.e364d06.el6op.noarch

How reproducible:
Always

Steps to Reproduce:
1.set up ose-1.2 env
2.create an scalable app, embed posgresql to this app
3.Log into app, type "psql" to connect posgresql successfully.
4.Upgrade env from 1.2 to 2.0
5.Log into app, type "psql" to connect posgresql

Actual results:
[scapythonapp-jialiu.rhn.com ~]\> psql
bash: [: =: unary operator expected
psql (8.4.18)
Type "help" for help.

A bash error is seen.


Expected results:
No error is seen.

Additional info:

Comment 2 Jason DeTiberus 2013-12-19 17:47:03 UTC
I've not been able to replicate this with my testing.

Could you attach the upgrade logs (including /tmp/oo-upgrade on the broker) for a host that exhibits this behavior.

Also, the output of rpm -qa | grep openshift could help as well.

The OPENSHIFT_POSTGRESQL_VERSION variable is being configured in the setup script for the postgresql cartridge, since the version of the cartridge from ose 1.2 is not listed as a compatible upgrade, the cartridge upgrade process will perform an incompatible upgrade (which copies the files over and executes the setup script).  In order for the variable to be missing, the cartridge upgrade for the gear must have failed (or not been run at all).

Without any more information, I would double check that the packages installed match the puddle that was used to install (instead of pulling older packages from the production repos).  The versions of the node upgrade model, msg-broker plugin, msg-node plugin, and oo-admin-upgrade tool shipped with the 2.0 repos caused gear upgrades to fail consistently.

Comment 4 Jason DeTiberus 2013-12-22 01:27:30 UTC
I've updated the installer to run the connection hooks for all gears after the gear upgrades are complete.  The issue was that cartridge upgrades do not do this step.

Comment 5 Johnny Liu 2013-12-23 08:06:50 UTC
Verified this bug following http://etherpad.corp.redhat.com/ose-2-0-upgrade-2013-12-20, and PASS.


On broker:
INFO: running /usr/lib/ruby/site_ruby/1.8/ose-upgrade/broker/upgrades/2/gears/04-node-run_connection_hooks
INFO: /usr/lib/ruby/site_ruby/1.8/ose-upgrade/broker/upgrades/2/gears/04-node-run_connection_hooks ran without error:
--BEGIN OUTPUT--

--END /usr/lib/ruby/site_ruby/1.8/ose-upgrade/broker/upgrades/2/gears/04-node-run_connection_hooks OUTPUT--


After upgrade is finished, log into app, then run "psql":
[scaperlapp-jialiu.osecdntest.com ~]\> echo $OPENSHIFT_POSTGRESQL_VERSION
8.4
[scaperlapp-jialiu.osecdntest.com ~]\> psql
psql (8.4.18)
Type "help" for help.

scaperlapp=# \q


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