deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject [3/4] git commit: Encapsulate the test for whether we need a DB in Deltacloud::need_database?
Date Wed, 20 Feb 2013 18:57:31 GMT
Encapsulate the test for whether we need a DB in Deltacloud::need_database?


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/9971eba4
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/9971eba4
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/9971eba4

Branch: refs/heads/master
Commit: 9971eba4230a747b62f0f89de8d68c911ba129a4
Parents: dbc0271
Author: David Lutterkort <lutter@redhat.com>
Authored: Tue Feb 19 20:51:16 2013 -0800
Committer: David Lutterkort <lutter@redhat.com>
Committed: Wed Feb 20 10:57:06 2013 -0800

----------------------------------------------------------------------
 server/lib/deltacloud_rack.rb |    4 ++++
 server/lib/initialize.rb      |    5 +++--
 2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/9971eba4/server/lib/deltacloud_rack.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud_rack.rb b/server/lib/deltacloud_rack.rb
index 32ff4e8..dbf51fc 100644
--- a/server/lib/deltacloud_rack.rb
+++ b/server/lib/deltacloud_rack.rb
@@ -75,6 +75,10 @@ module Deltacloud
     ENV['API_FRONTEND'].split(',')
   end
 
+  def self.need_database?
+    frontends.include?('cimi') || ENV['RACK_ENV'] == 'test'
+  end
+
   require 'sinatra/base'
   require_relative './deltacloud/helpers/deltacloud_helper'
   require_relative './sinatra/rack_accept'

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/9971eba4/server/lib/initialize.rb
----------------------------------------------------------------------
diff --git a/server/lib/initialize.rb b/server/lib/initialize.rb
index ec38c0a..c82bd8d 100644
--- a/server/lib/initialize.rb
+++ b/server/lib/initialize.rb
@@ -23,5 +23,6 @@ require_relative './initializers/mock_initialize'
 # Configure available frontends
 require_relative './initializers/frontend_initialize'
 
-# If CIMI is enabled, then initialize database stuff
-require_relative './initializers/database_initialize' if frontends.include? 'cimi'
+if Deltacloud::need_database?
+  require_relative './initializers/database_initialize'
+end


Mime
View raw message