You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by ma...@apache.org on 2012/06/01 14:58:59 UTC
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
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 <ma...@redhat.com>
Authored: Fri May 18 12:55:26 2012 +0300
Committer: marios <ma...@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)}" }