deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@redhat.com
Subject [PATCH] Adds destroy_image for rackspace driver
Date Thu, 21 Jul 2011 14:26:25 GMT
From: marios <marios@redhat.com>


Signed-off-by: marios <marios@redhat.com>
---
 .../drivers/rackspace/rackspace_driver.rb          |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb b/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
index 7829b02..e7c52d7 100644
--- a/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
+++ b/server/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
@@ -109,6 +109,16 @@ class RackspaceDriver < Deltacloud::BaseDriver
     end
   end
 
+  def destroy_image(credentials, image_id)
+    rax_client = new_client(credentials)
+    safely do
+      image = rax_client.get_image(image_id.to_i)
+      unless image.delete!
+        raise "ERROR: Cannot delete image with ID:#{image_id}"
+      end
+    end
+  end
+
   def run_on_instance(credentials, opts={})
     target = instance(credentials, :id => opts[:id])
     param = {}
-- 
1.7.3.4


Mime
View raw message