In V1 it is valid to have an env var reference another env var as follows: export SOME_VAR=$SOME_OTHER_VAR We don't support this in V2. The migration should resolve these references.
What context were these used? Any ruby code reading these environment variables would have failed.
After talking about this with Jhon, we decided that we should delete the OPENSHIFT_LOG_DIR var (which is the variable which is currently a reference to another var), since we won't update the value of this old var if the new one changes.
Commit pushed to master at https://github.com/openshift/li https://github.com/openshift/li/commit/420a64a0426e111d0368684a4b24a4012c24670e Fix bug 963071
This issue not fixed on devenv_3247, with following steps: 1. Create php app on old instance 2. Write OPENSHIFT_LOG_DIR with following content to the app .env dir export OPENSHIFT_LOG_DIR=$OPENSHIFT_PHP_LOG_DIR 3. Change the context of this file to match with others 4. Do upgrade and migrate During the migration: Migrated PATH v1 value [export PATH=/usr/libexec/openshift/cartridges/php-5.3/info/bin/:/usr/libexec/openshift/cartridges/abstract-httpd/info/bin/:/usr/libexec/openshift/cartridges/abstract/info/bin/:/bin:/usr/bin:/sbin:/usr/sbin] to raw value [/usr/libexec/openshift/cartridges/php-5.3/info/bin/:/usr/libexec/openshift/cartridges/abstract-httpd/info/bin/:/usr/libexec/openshift/cartridges/abstract/info/bin/:/bin:/usr/bin:/sbin:/usr/sbin] Migrated OPENSHIFT_LOG_DIR v1 value [export OPENSHIFT_LOG_DIR=$OPENSHIFT_PHP_LOG_DIR] to raw value [$OPENSHIFT_PHP_LOG_DIR] After migration: [app1-bmeng111.dev.rhcloud.com 5199ec78ac3424090e000001]\> env|grep LOG OPENSHIFT_PHP_LOG_DIR=/var/lib/openshift/5199ec78ac3424090e000001/php//logs/ OPENSHIFT_LOG_DIR=$OPENSHIFT_PHP_LOG_DIR LOGNAME=5199ec78ac3424090e000001 Move bug back.
We've only coded to remove the OPENSHIFT_LOG_DIR var from TYPELESS_TRANSLATED_VARS. There should not be any discrete OPENSHIFT_LOG_DIR variables in existing V1 apps.
According comment#5, Add TYPELESS_TRANSLATED_VARS file under /var/lib/openshift/$uuid/.env, with following contents: export OPENSHIFT_RUNTIME_DIR="/var/lib/openshift/e419a130bb9011e2b6f522000a8dbcca/diy-0.1/runtime/" export OPENSHIFT_RUN_DIR="/var/lib/openshift/e419a130bb9011e2b6f522000a8dbcca/diy-0.1/run/" export OPENSHIFT_GEAR_TYPE="diy-0.1" export OPENSHIFT_LOG_DIR="$OPENSHIFT_DIY_LOG_DIR" export OPENSHIFT_GEAR_DIR="/var/lib/openshift/e419a130bb9011e2b6f522000a8dbcca/diy-0.1/" export OPENSHIFT_GEAR_CTL_SCRIPT="/usr/libexec/openshift/cartridges/diy-0.1/info/bin/app_ctl.sh" After migration, OPENSHIFT_LOG_DIR will not be translated to variables anymore. Move bug to verified.
Hi Paul, Should the file TYPELESS_TRANSLATED_VARS be deleted after migration? If not, the TYPELESS_TRANSLATED_VARS and it's value will be sourced to the gear bash. And can be shown via command 'env' in rhcsh.
Thanks for pointing this out - the TYPELESS_TRANSLATED_VARS file should be deleted after migrating - I've made a PR for the fix.
Commit pushed to master at https://github.com/openshift/li https://github.com/openshift/li/commit/2792851986400cb5352eff8909ac94edbfb143c5 Fix bug 963071: remove TYPELESS_TRANSLATED_VARS after migrating
Verified on devenv_3258 The TYPELESS_TRANSLATED_VARS is now removed after migration
@Paul I discovered there are still some environment variables referring to another environment variable in TYPELESS_TRANSLATED_VARS in prod, they are like: export OPENSHIFT_NOSQL_DB_PORT="$OPENSHIFT_MONGODB_DB_PORT" export OPENSHIFT_NOSQL_DB_HOST="$OPENSHIFT_MONGODB_DB_HOST" export OPENSHIFT_NOSQL_DB_PASSWORD="$OPENSHIFT_MONGODB_DB_PASSWORD" export OPENSHIFT_NOSQL_DB_URL="$OPENSHIFT_MONGODB_DB_URL" export OPENSHIFT_NOSQL_DB_USERNAME="$OPENSHIFT_MONGODB_DB_USERNAME" export OPENSHIFT_DB_URL="$OPENSHIFT_MYSQL_DB_URL" export OPENSHIFT_DB_SOCKET="$OPENSHIFT_MYSQL_DB_SOCKET" export OPENSHIFT_DB_PORT="$OPENSHIFT_MYSQL_DB_PORT" export OPENSHIFT_DB_HOST="$OPENSHIFT_MYSQL_DB_HOST" export OPENSHIFT_DB_PASSWORD="$OPENSHIFT_MYSQL_DB_PASSWORD" export OPENSHIFT_DB_USERNAME="$OPENSHIFT_MYSQL_DB_USERNAME" Above env vars will be migrated and sourced. After migration, they will be like: OPENSHIFT_NOSQL_DB_HOST=$OPENSHIFT_MONGODB_DB_HOST OPENSHIFT_NOSQL_DB_PASSWORD=$OPENSHIFT_MONGODB_DB_PASSWORD OPENSHIFT_NOSQL_DB_PORT=$OPENSHIFT_MONGODB_DB_PORT OPENSHIFT_NOSQL_DB_URL=$OPENSHIFT_MONGODB_DB_URL OPENSHIFT_NOSQL_DB_USERNAME=$OPENSHIFT_MONGODB_DB_USERNAME OPENSHIFT_DB_HOST=$OPENSHIFT_MYSQL_DB_HOST OPENSHIFT_DB_PASSWORD=$OPENSHIFT_MYSQL_DB_PASSWORD OPENSHIFT_DB_PORT=$OPENSHIFT_MYSQL_DB_PORT OPENSHIFT_DB_SOCKET=$OPENSHIFT_MYSQL_DB_SOCKET OPENSHIFT_DB_URL=$OPENSHIFT_MYSQL_DB_URL OPENSHIFT_DB_USERNAME=$OPENSHIFT_MYSQL_DB_USERNAME Maybe they also need to be processed?
Commit pushed to master at https://github.com/openshift/li https://github.com/openshift/li/commit/d87b6e6012f0bab5b1a44afd6180ba15bc940b95 Fix bug 963071
QE- We had a mismatch on this issue in the development team, so what you should look for has changed. The latest PR implements the following behavior: 1. If an entry in TYPELESS_TRANSLATED_VARS is a reference to another env var, attempt to resolve it and write the discrete var with the _content_ of the referenced var. 2. If you cannot resolve the referenced var, do not create a discrete file for the _referencing_ var.
Test this again on devenv-3268, with the following data: export OPENSHIFT_NOSQL_DB_PORT="$OPENSHIFT_MONGODB_DB_PORT" export OPENSHIFT_NOSQL_DB_HOST="$OPENSHIFT_MONGODB_DB_HOST" export OPENSHIFT_NOSQL_DB_PASSWORD="$OPENSHIFT_MONGODB_DB_PASSWORD" export OPENSHIFT_NOSQL_DB_URL="$OPENSHIFT_MONGODB_DB_URL" export OPENSHIFT_NOSQL_DB_USERNAME="$OPENSHIFT_MONGODB_DB_USERNAME" export OPENSHIFT_DB_URL=$OPENSHIFT_MYSQL_DB_URL export OPENSHIFT_DB_SOCKET=$OPENSHIFT_MYSQL_DB_SOCKET export OPENSHIFT_DB_PORT=$OPENSHIFT_MYSQL_DB_PORT export OPENSHIFT_DB_HOST=$OPENSHIFT_MYSQL_DB_HOST export OPENSHIFT_DB_PASSWORD=$OPENSHIFT_MYSQL_DB_PASSWORD export OPENSHIFT_DB_USERNAME=$OPENSHIFT_MYSQL_DB_USERNAME export OPENSHIFT_RUNTIME_DIR="/var/lib/openshift/e419a130bb9011e2b6f522000a8dbcca/diy-0.1/runtime/" export OPENSHIFT_RUN_DIR="/var/lib/openshift/e419a130bb9011e2b6f522000a8dbcca/diy-0.1/run/" export OPENSHIFT_GEAR_TYPE="diy-0.1" export OPENSHIFT_LOG_DIR="$OPENSHIFT_DIY_LOG_DIR" export OPENSHIFT_GEAR_DIR="/var/lib/openshift/e419a130bb9011e2b6f522000a8dbcca/diy-0.1/" export OPENSHIFT_GEAR_CTL_SCRIPT="/usr/libexec/openshift/cartridges/diy-0.1/info/bin/app_ctl.sh" export TEST_VAR_1='foo' export TEST_VAR_2='bar' export TEST_VAR_3="baz" After migration, all the vars which referenced to other ones are all removed from the user env_vars list. But the previous removed two, OPENSHIFT_GEAR_TYPE OPENSHIFT_GEAR_CTL_SCRIPT are present. From the code, found the blacklist has been deleted. Not sure if this the expected result. Please help confirm, and then I will mark the bug as verified.
This can be migrated successfully on devenv_3269, the reason for the result in comment 14 is because the environment variables being referred to are null themselves(in comment 14, the TYPELESS_TRANSLATED_VARS is create manually for test purpose, but no db cartridges are actually added). Re-test and after v2 migration, the result is as follows: OPENSHIFT_NOSQL_DB_HOST=127.0.250.129 OPENSHIFT_NOSQL_DB_PASSWORD=ZFJaQyv1QEsu OPENSHIFT_NOSQL_DB_PORT=27017 OPENSHIFT_NOSQL_DB_URL=mongodb://admin:ZFJaQyv1QEsu.250.129:27017/ OPENSHIFT_NOSQL_DB_USERNAME=admin OPENSHIFT_DB_HOST=127.0.250.129 OPENSHIFT_DB_PASSWORD=kL9CllAll9SG OPENSHIFT_DB_PORT=3306 OPENSHIFT_DB_SOCKET=/var/lib/openshift/50cb1304c46511e2992b22000a974b0e//mysql-5.1/socket/mysql.sock OPENSHIFT_DB_URL=mysql://adminRMmgKsZ:kL9CllAll9SG.250.129:3306/ OPENSHIFT_DB_USERNAME=adminRMmgKsZ Just need to confirm, the OPENSHIFT_LOG_DIR and OPENSHIFT_GEAR_CTL_SCRIPT were once in blacklist and will be abandoned after v2 migration. With this fix, the are sourced again. Should the be there are removed? After v2 migration: OPENSHIFT_GEAR_CTL_SCRIPT=/usr/libexec/openshift/cartridges/diy-0.1/info/bin/app_ctl.sh OPENSHIFT_LOG_DIR=/var/lib/openshift/50cb1304c46511e2992b22000a974b0e/diy-0.1/logs/
PR submitted. The (hopefully!) final behavior to test is as follows: The following transformations are applied to each variable in TYPELESS_TRANSLATED_VARS: 1. OPENSHIFT_GEAR_CTL_SCRIPT is blacklisted and will not be broken out into a discrete variable. 2. Other variables are broken out into discrete variables as follows: a. If the variable is assigned to a reference to another variable, and the referenced variable can be resolved, a discrete env variable is created with the value of the referenced variable. b. If the variable is assigned to a reference to another variable, and the referenced variable cannot be resolved, no discrete env variable is created. c. If the variable is assigned to a raw value, a discrete env variable is created with the literal value.
Commit pushed to master at https://github.com/openshift/li https://github.com/openshift/li/commit/ac7c92c7b5b01fd7c38728119cb06da02c63e7ff Fix bug 963071: re-add blacklist for TYPELESS_TRANSLATED_VARS
Fix will be in devenv ami 3278
Test this issue with following contents in TYPELESS_TRANSLATED_VARS, app with all 3 dbs added. #cat TYPELESS_TRANSLATED_VARS export OPENSHIFT_NOSQL_DB_PORT="$OPENSHIFT_MONGODB_DB_PORT" export OPENSHIFT_NOSQL_DB_HOST="$OPENSHIFT_MONGODB_DB_HOST" export OPENSHIFT_NOSQL_DB_PASSWORD="$OPENSHIFT_MONGODB_DB_PASSWORD" export OPENSHIFT_NOSQL_DB_URL="$OPENSHIFT_MONGODB_DB_URL" export OPENSHIFT_NOSQL_DB_USERNAME="$OPENSHIFT_MONGODB_DB_USERNAME" export OPENSHIFT_DB_URL=$OPENSHIFT_MYSQL_DB_URL export OPENSHIFT_DB_SOCKET=$OPENSHIFT_MYSQL_DB_SOCKET export OPENSHIFT_DB_PORT=$OPENSHIFT_MYSQL_DB_PORT export OPENSHIFT_DB_HOST=$OPENSHIFT_MYSQL_DB_HOST export OPENSHIFT_DB_PASSWORD=$OPENSHIFT_MYSQL_DB_PASSWORD export OPENSHIFT_DB_USERNAME=$OPENSHIFT_MYSQL_DB_USERNAME export OPENSHIFT_RUNTIME_DIR="/var/lib/openshift/51a2ce44aef0570700000001/diy-0.1/runtime/" export OPENSHIFT_RUN_DIR="/var/lib/openshift/51a2ce44aef0570700000001/diy-0.1/run/" export OPENSHIFT_GEAR_TYPE="diy-0.1" export OPENSHIFT_LOG_DIR="$OPENSHIFT_DIY_LOG_DIR" export OPENSHIFT_GEAR_DIR="/var/lib/openshift/51a2ce44aef0570700000001/diy-0.1/" export OPENSHIFT_GEAR_CTL_SCRIPT="/usr/libexec/openshift/cartridges/diy-0.1/info/bin/app_ctl.sh" export TEST_VAR_1='foo' export TEST_VAR_2='bar' export TEST_VAR_3="baz" export TEST_VAR=$TEST_VAR_NO_EXIST After migration, OPENSHIFT_DB_HOST=127.1.2.1 OPENSHIFT_DB_PASSWORD=is1k8qxG_WPX OPENSHIFT_DB_PORT=3306 OPENSHIFT_DB_SOCKET=/var/lib/openshift/51a2ce44aef0570700000001//mysql-5.1/socket/mysql.sock OPENSHIFT_DB_URL=mysql://adminHlzvZlg:is1k8qxG_WPX.2.1:3306/ OPENSHIFT_DB_USERNAME=adminHlzvZlg OPENSHIFT_NOSQL_DB_HOST=127.1.2.1 OPENSHIFT_NOSQL_DB_PASSWORD=_a7t5IlsqWRD OPENSHIFT_NOSQL_DB_PORT=27017 OPENSHIFT_NOSQL_DB_URL=mongodb://admin:_a7t5IlsqWRD.2.1:27017/ OPENSHIFT_NOSQL_DB_USERNAME=admin TEST_VAR_1=foo TEST_VAR_2=bar TEST_VAR_3=baz OPENSHIFT_GEAR_TYPE=diy-0.1 OPENSHIFT_GEAR_DIR=/var/lib/openshift/51a2ce44aef0570700000001/diy-0.1/ OPENSHIFT_LOG_DIR=/var/lib/openshift/51a2ce44aef0570700000001/diy-0.1/logs/ OPENSHIFT_RUN_DIR=/var/lib/openshift/51a2ce44aef0570700000001/diy-0.1/run/ OPENSHIFT_RUNTIME_DIR=/var/lib/openshift/51a2ce44aef0570700000001/diy-0.1/runtime/ Var which in blacklist is not created. OPENSHIFT_GEAR_CTL_SCRIPT Var which cannot be resolved is not created. TEST_VAR Move bug to verified.
Oh, missed the build info. Verified on devenv_3277.