1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Sometimes :Environments is not a key

This commit is contained in:
Sarah Vessels 2013-11-11 17:35:45 -05:00
parent 1955da2027
commit 0bee5e8f42

View file

@ -15,10 +15,12 @@ module Fog
def all
data = []
service.get_organization(href).body[:Locations][:Location].each do |d|
if d[:Environments][:Environment].is_a?(Array)
d[:Environments][:Environment].each { |e| data << e }
environments = d[:Environments]
next unless environments
if environments[:Environment].is_a?(Array)
environments[:Environment].each { |e| data << e }
else
data << d[:Environments][:Environment]
data << environments[:Environment]
end
end
load(data)