You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2012/10/31 13:58:28 UTC

[1/3] git commit: Replaced YAML.load with YAML.load_file (DTACLOUD-347)

Updated Branches:
  refs/heads/master 66762e814 -> b56563920


Replaced YAML.load with YAML.load_file (DTACLOUD-347)

* Fix nasty memory leaking issue under MRI 1.9.3p194

Signed-off-by: Michal fojtik <mf...@redhat.com>


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

Branch: refs/heads/master
Commit: b5656392015eb43223bf999474ba61dcab56c6ea
Parents: 03619cf
Author: Michal Fojtik <mf...@redhat.com>
Authored: Thu Oct 18 21:40:26 2012 +0200
Committer: Michal fojtik <mf...@redhat.com>
Committed: Wed Oct 31 13:57:59 2012 +0100

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


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b5656392/server/lib/deltacloud/drivers.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers.rb b/server/lib/deltacloud/drivers.rb
index 14e7ee0..4e0f127 100644
--- a/server/lib/deltacloud/drivers.rb
+++ b/server/lib/deltacloud/drivers.rb
@@ -26,7 +26,7 @@ module Deltacloud
         Thread::current[:drivers] = {}
         top_srcdir = File.join(File.dirname(__FILE__), '..', '..')
         Dir[File.join(top_srcdir, 'config', 'drivers', '*.yaml')].each do |driver_file|
-          Thread::current[:drivers].merge!(YAML::load(File::read(driver_file)))
+          Thread::current[:drivers].merge!(YAML::load_file(driver_file))
         end
       end
       Thread::current[:drivers]

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b5656392/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 817ae0b..c6dd464 100644
--- a/server/lib/deltacloud/drivers/mock/mock_client.rb
+++ b/server/lib/deltacloud/drivers/mock/mock_client.rb
@@ -56,10 +56,10 @@ module Deltacloud::Drivers::Mock
       files(collection).map { |f| File::basename(f, ".yml") }
     end
 
-    def load(collection, id)
+    def load_collection(collection, id)
       fname = file(collection, id)
       begin
-        YAML.load(File.read(fname))
+        YAML.load_file(fname)
       rescue Errno::ENOENT
         nil
       end
@@ -73,12 +73,12 @@ module Deltacloud::Drivers::Mock
     # Return the object with id +id+ of class +klass+ from the collection
     # derived from the classes name
     def build(klass, id)
-      klass.new(load(collection_name(klass), id))
+      klass.new(load_collection(collection_name(klass), id))
     end
 
     # Return an array of hashes of all the resources in the collection
     def load_all(collection)
-      members(collection).map { |id| load(collection, id) }
+      members(collection).map { |id| load_collection(collection, id) }
     end
 
     # Return an array of model objects of the resources in the collection