1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-24 02:03:52 +03:00

Image delete function now copes with directories

This commit is contained in:
Tino Vázquez 2010-10-13 15:36:17 +02:00
parent 9d959c2e55
commit 3cc0f52988

View File

@ -218,10 +218,18 @@ module OpenNebula
######################################################################## ########################################################################
def remove(source) def remove(source)
if File.exists?(source) if File.exists?(source)
begin if File.directory?(source)
FileUtils.rm(source) begin
rescue Exception => e FileUtils.rmdir(source)
return OpenNebula::Error.new(e.message) rescue Exception => e
return OpenNebula::Error.new(e.message)
end
else
begin
FileUtils.rm(source)
rescue Exception => e
return OpenNebula::Error.new(e.message)
end
end end
end end