Skip to content

Commit

Permalink
Upon Google::Apis::ClientError, return an empty object instead of nil…
Browse files Browse the repository at this point in the history
… so that wait_for will evaluate its block
  • Loading branch information
Rob Chekaluk committed Nov 10, 2023
1 parent 0ad3fdd commit 134aec7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/fog/compute/google/models/disks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def all(zone: nil, filter: nil, max_results: nil, order_by: nil,

def get(identity, zone = nil)
if zone

disk = service.get_disk(identity, zone).to_h

# Force the hash to contain a :users key so that it will override any :users key in the existing object
Expand All @@ -49,7 +50,8 @@ def get(identity, zone = nil)
end
rescue ::Google::Apis::ClientError => e
raise e unless e.status_code == 404
nil
# Return an empty object so that wait_for processes the block
return new({:status => nil})
end

# Returns an attached disk configuration hash.
Expand Down

0 comments on commit 134aec7

Please sign in to comment.