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:
parent
a6e4535309
commit
8c3a4a2342
1 changed files with 6 additions and 4 deletions
|
@ -42,13 +42,15 @@ module Fog
|
||||||
service.disks.merge_attributes(data)
|
service.disks.merge_attributes(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy(async=true)
|
||||||
requires :name, :zone_name
|
requires :name, :zone_name
|
||||||
operation = service.delete_disk(name, zone_name)
|
operation = service.delete_disk(name, zone_name)
|
||||||
# wait until "DONE" to ensure the operation doesn't fail, raises exception on error
|
# wait until "DONE" to ensure the operation doesn't fail, raises exception on error
|
||||||
Fog.wait_for do
|
if not async
|
||||||
operation = service.get_zone_operation(zone_name, operation.body["name"])
|
Fog.wait_for do
|
||||||
operation.body["status"] == "DONE"
|
operation = service.get_zone_operation(zone_name, operation.body["name"])
|
||||||
|
operation.body["status"] == "DONE"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
operation
|
operation
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue