Mohammed Morsi
2008-Nov-10 19:18 UTC
[Ovirt-devel] [PATCH server] build correct db using configured rails env in ovirt-server-install
set RAILS_ENV in conf/ovirt-rails.sysconf before building --- scripts/ovirt-server-install | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/scripts/ovirt-server-install b/scripts/ovirt-server-install index 055ff4c..afa2a64 100755 --- a/scripts/ovirt-server-install +++ b/scripts/ovirt-server-install @@ -5,6 +5,13 @@ OVIRT_CFG=/etc/ovirt-server DATABASE=ovirt USERNAME=ovirt +[ -r /etc/sysconfig/ovirt-rails ] && . /etc/sysconfig/ovirt-rails +if [ ! -z "$RAILS_ENV" ]; then + DATABASE="$DATABASE"_"$RAILS_ENV" + export RAILS_ENV +else + export RAILS_ENV="production" +fi EXISTS_FILE=${OVIRT_CFG}/db/exists PW_FILE=${OVIRT_CFG}/db/dbaccess @@ -186,7 +193,7 @@ touch $EXISTS_FILE cd ${OVIRT_DIR} mkdir -p log -export RAILS_ENV="production" && rake db:migrate +rake db:migrate cd - ${OVIRT_DIR}/script/grant_admin_privileges ovirtadmin -- 1.5.6.5
Mohammed Morsi
2008-Nov-10 19:29 UTC
[Ovirt-devel] Re: [PATCH server] build correct db using configured rails env in ovirt-server-install
Mohammed Morsi wrote:> set RAILS_ENV in conf/ovirt-rails.sysconf before building > --- >This patch is needed to fix the test suite and useful just for general development. After it is applied, anyone (including autobuild) can set their server to be in the 'development' or any other mode as when building a new rpm. oVirt will pick this up and create / configure the appropriate database and set rails to run in the proper environment. Many of the 'rake' features, particularly those relating to testing, default to generating a schema from the 'development' database before creating the test one. This will fix selenium and a few other tests as well, since the environment can be set to development during the build phase, the application's user, as defined in the application controller, will be statically set to ovirtadmin, thus manual authentication will not be required (obviously a problem for autobuild) -Mo