mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[google|compute] zone in disks.get is now optional
This commit is contained in:
parent
d06ce67cd6
commit
d26b14fb7b
1 changed files with 15 additions and 5 deletions
|
@ -14,11 +14,21 @@ module Fog
|
||||||
load(data)
|
load(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(identity, zone)
|
def get(identity, zone=nil)
|
||||||
data = service.get_disk(identity, zone).body
|
response = nil
|
||||||
new(data)
|
if zone.nil?
|
||||||
rescue Excon::Errors::NotFound
|
service.list_zones.body['items'].each do |zone|
|
||||||
nil
|
begin
|
||||||
|
response = service.get_disk(identity, zone['name'])
|
||||||
|
break if response.status == 200
|
||||||
|
rescue Fog::Errors::Error
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
response = service.get_disk(identity, zone)
|
||||||
|
end
|
||||||
|
return nil if response.nil?
|
||||||
|
new(response.body)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue