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:
parent
9d959c2e55
commit
3cc0f52988
@ -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
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user