mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-08 21:17:43 +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)
|
||||
if File.exists?(source)
|
||||
begin
|
||||
FileUtils.rm(source)
|
||||
rescue Exception => e
|
||||
return OpenNebula::Error.new(e.message)
|
||||
if File.directory?(source)
|
||||
begin
|
||||
FileUtils.rmdir(source)
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user