From 8c3a4a2342b4e1147f3fe9b65bac1821e8b11003 Mon Sep 17 00:00:00 2001 From: Benson Kalahar Date: Thu, 10 Apr 2014 12:57:13 -0700 Subject: [PATCH] Makes disk delete optionally async --- lib/fog/google/models/compute/disk.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/fog/google/models/compute/disk.rb b/lib/fog/google/models/compute/disk.rb index 4592f07df..c56232f2c 100644 --- a/lib/fog/google/models/compute/disk.rb +++ b/lib/fog/google/models/compute/disk.rb @@ -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