deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 5/8] Mock: Require 'yaml' in client instead of driver
Date Mon, 18 Feb 2013 13:41:15 GMT
From: Michal Fojtik <mfojtik@redhat.com>

The YAML is really required in MockClient (I think this
require is not required here anyway ;-)

This patch will also make .store() method return the stored
object, so in driver we don't need to create a special var for it.

Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/lib/deltacloud/drivers/mock/mock_client.rb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/server/lib/deltacloud/drivers/mock/mock_client.rb b/server/lib/deltacloud/drivers/mock/mock_client.rb
index 449b6a8..eb37176 100644
--- a/server/lib/deltacloud/drivers/mock/mock_client.rb
+++ b/server/lib/deltacloud/drivers/mock/mock_client.rb
@@ -19,6 +19,7 @@
 
 module Deltacloud::Drivers::Mock
 
+  require 'yaml'
   require 'fileutils'
 
   class Client
@@ -66,6 +67,7 @@ module Deltacloud::Drivers::Mock
     def store(collection, obj)
       raise "Why no obj[:id] ?" unless obj[:id]
       File::open(file(collection, obj[:id]), "w") { |f| YAML.dump(obj, f) }
+      obj
     end
 
     # Return the object with id +id+ of class +klass+ from the collection
-- 
1.8.1.2


Mime
View raw message