Jason Guiditta
2008-Nov-07 15:40 UTC
[Ovirt-devel] [PATCH server] Fix 2 bugs from previous refactoring.
* Killed last instance of OVIRT_DIR, sinc it doesn't matter. * Removed ENV['RAILS_ENV'] param to database_connect, since we set it earlier in active_record_env when the daemon is started. Still testing locally on an appliance, so please check there as well so we make sure this really works. Signed-off-by: Jason Guiditta <jguiditt at redhat.com> --- src/dutils/active_record_env.rb | 6 +++--- src/script/grant_admin_privileges | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/dutils/active_record_env.rb b/src/dutils/active_record_env.rb index 07a57ec..9bda151 100644 --- a/src/dutils/active_record_env.rb +++ b/src/dutils/active_record_env.rb @@ -29,10 +29,10 @@ ENV['RAILS_ENV'] = 'production' || ENV['RAILS_ENV'] require File.dirname(__FILE__) + '/../config/boot' require "#{RAILS_ROOT}/config/environment" -def database_connect(environment) +def database_connect conf = YAML::load(File.open(File.dirname(__FILE__) + '/../config/database.yml')) - ActiveRecord::Base.establish_connection(conf[environment]) + ActiveRecord::Base.establish_connection(conf[ENV['RAILS_ENV']]) end # Open ActiveRecord connection -database_connect(ENV['RAILS_ENV']) +database_connect diff --git a/src/script/grant_admin_privileges b/src/script/grant_admin_privileges index 866fd44..4cafa74 100755 --- a/src/script/grant_admin_privileges +++ b/src/script/grant_admin_privileges @@ -1,11 +1,11 @@ #!/usr/bin/ruby - +#FIXME: this should really be a rake task, then we get half of this stuff for free $: << File.join(File.dirname(__FILE__), '../dutils') require 'active_record_env' # Get configuration options... -ldap_config = YAML::load(File.open("#{OVIRT_DIR}/config/ldap.yml")) +ldap_config = YAML::load(File.open(File.dirname(__FILE__) +"/../config/ldap.yml")) uid = ARGV[0] base, host = ldap_config["production"]["base"], ldap_config["production"]["host"] -- 1.5.6.5
Scott Seago
2008-Nov-07 18:39 UTC
[Ovirt-devel] [PATCH server] Fix 2 bugs from previous refactoring.
Jason Guiditta wrote:> * Killed last instance of OVIRT_DIR, sinc it doesn't matter. > * Removed ENV['RAILS_ENV'] param to database_connect, since we set it earlier in active_record_env when the daemon is started. > > Still testing locally on an appliance, so please check there as well so we make sure this really works. >Works for me. ACK Scott