deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [1/3] git commit: Server: make sure we initialize the DB dir and the mock driver's data properly
Date Mon, 03 Dec 2012 13:56:33 GMT
Updated Branches:
  refs/heads/master d9e21e027 -> ca39bcaed


Server: make sure we initialize the DB dir and the mock driver's data properly

Server startup failed if /var/tmp/deltacloud-mock-$USER failed because the
DB initialization code did not create that directory. Creating that
directory fooled the logic in the mock driver that determined if the stock
data needed to be copied there.


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

Branch: refs/heads/master
Commit: ca39bcaedb77c0aeecca89ee886a4cb2c41e80bc
Parents: 87d45dd
Author: David Lutterkort <lutter@redhat.com>
Authored: Sun Dec 2 23:54:09 2012 -0800
Committer: marios <marios@redhat.com>
Committed: Mon Dec 3 10:11:04 2012 +0200

----------------------------------------------------------------------
 server/lib/db.rb                                  |    4 ++++
 server/lib/deltacloud/drivers/mock/mock_client.rb |    4 +---
 2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/ca39bcae/server/lib/db.rb
----------------------------------------------------------------------
diff --git a/server/lib/db.rb b/server/lib/db.rb
index ac6d913..e6fe761 100644
--- a/server/lib/db.rb
+++ b/server/lib/db.rb
@@ -21,6 +21,10 @@ module Deltacloud
 
   def self.initialize_database
     DataMapper::Logger.new($stdout, :debug)
+    dbdir = File::dirname(DATABASE_LOCATION)
+    unless File::directory?(dbdir)
+      FileUtils::mkdir(dbdir)
+    end
     DataMapper::setup(:default, "sqlite://#{DATABASE_LOCATION}")
     DataMapper::finalize
     DataMapper::auto_upgrade!

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/ca39bcae/server/lib/deltacloud/drivers/mock/mock_client.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/mock/mock_client.rb b/server/lib/deltacloud/drivers/mock/mock_client.rb
index c6dd464..919ee27 100644
--- a/server/lib/deltacloud/drivers/mock/mock_client.rb
+++ b/server/lib/deltacloud/drivers/mock/mock_client.rb
@@ -26,9 +26,7 @@ module Deltacloud::Drivers::Mock
       @storage_root = storage_root
       @collections = []
 
-      if ! File::directory?(@storage_root)
-        FileUtils::rm_rf(@storage_root)
-        FileUtils::mkdir_p(@storage_root, :mode => 0750)
+      if ! File::directory?(File::join(@storage_root, "images"))
         data = Dir[File::join(File::dirname(__FILE__), "data", "*")]
         FileUtils::cp_r(data, @storage_root)
       end


Mime
View raw message