1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Makes disk delete optionally async

This commit is contained in:
Benson Kalahar 2014-04-10 12:57:13 -07:00
parent a6e4535309
commit 8c3a4a2342

View file

@ -42,13 +42,15 @@ module Fog
service.disks.merge_attributes(data)
end
def destroy
def destroy(async=true)
requires :name, :zone_name
operation = service.delete_disk(name, zone_name)
# wait until "DONE" to ensure the operation doesn't fail, raises exception on error
Fog.wait_for do
operation = service.get_zone_operation(zone_name, operation.body["name"])
operation.body["status"] == "DONE"
if not async
Fog.wait_for do
operation = service.get_zone_operation(zone_name, operation.body["name"])
operation.body["status"] == "DONE"
end
end
operation
end