incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core] Added with_config method to client to allow switching drivers/providers using Ruby block syntax.
Date Thu, 13 Jan 2011 10:25:44 GMT
From: Michal Fojtik <mfojtik@redhat.com>

---
 client/lib/deltacloud.rb |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/client/lib/deltacloud.rb b/client/lib/deltacloud.rb
index 6985d5c..01cc2ca 100644
--- a/client/lib/deltacloud.rb
+++ b/client/lib/deltacloud.rb
@@ -77,6 +77,15 @@ module DeltaCloud
       yield self if block_given?
     end
 
+    def with_config(opts, &block)
+      api_instance = self.dup
+      api_instance.use_driver(opts[:driver],
+                             :username => opts[:username],
+                             :password => opts[:password],
+                             :provider => opts[:provider])
+      yield api_instance
+    end
+
     def connect(&block)
       yield self
     end
-- 
1.7.3.4


Mime
View raw message