deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject git commit: Adds destroy_image action to image xml - also adds guard and verbose error message when an error occurs destroying image for openstack driver (e.g. trying destroy system image). Addresses JIRA DTACLOUD_207
Date Fri, 01 Jun 2012 12:58:59 GMT
Updated Branches:
  refs/heads/master 54252e4be -> cdc488e6d


Adds destroy_image action to image xml - also adds guard and verbose
error message when an error occurs destroying image for openstack driver
(e.g. trying destroy system image). Addresses JIRA DTACLOUD_207

https://issues.apache.org/jira/browse/DTACLOUD-207


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

Branch: refs/heads/master
Commit: cdc488e6deed03777afb12f6c5804de7fa49185c
Parents: 54252e4
Author: marios <marios@redhat.com>
Authored: Fri May 18 12:55:26 2012 +0300
Committer: marios <marios@redhat.com>
Committed: Fri Jun 1 15:48:42 2012 +0300

----------------------------------------------------------------------
 .../drivers/openstack/openstack_driver.rb          |   12 ++++++++----
 server/views/images/show.xml.haml                  |    1 +
 2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/cdc488e6/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
index 0ed2baf..18cc0c1 100644
--- a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
+++ b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
@@ -86,11 +86,11 @@ module Deltacloud
 
         def destroy_image(credentials, image_id)
           os = new_client(credentials)
-          safely do
+          begin
             image = os.get_image(image_id)
-            unless image.delete!
-              raise "ERROR: Cannot delete image with ID:#{image_id}"
-            end
+            image.delete!
+          rescue => e
+            raise Deltacloud::ExceptionHandler::BackendError.new(e, "ERROR: Cannot delete
image with ID:#{image_id}.")
           end
         end
 
@@ -337,6 +337,10 @@ private
             status 404
           end
 
+          on /Exception::Other/ do
+            status 500
+          end
+
         end
 
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/cdc488e6/server/views/images/show.xml.haml
----------------------------------------------------------------------
diff --git a/server/views/images/show.xml.haml b/server/views/images/show.xml.haml
index 6f52218..ffbe3a0 100644
--- a/server/views/images/show.xml.haml
+++ b/server/views/images/show.xml.haml
@@ -10,3 +10,4 @@
         %hardware_profile{ :href => hardware_profile_url(profile.name), :id => profile.name,
:rel => :hardware_profile }
   %actions
     %link{ :rel => 'create_instance', :method => :post, :href => "#{instances_url};image_id=#{@image.id}"}
+    %link{ :rel => 'destroy_image', :method => :delete, :href => "#{destroy_image_url(@image.id)}"
}


Mime
View raw message