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)
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue