diff --git a/app/models/manageiq/providers/google/cloud_manager/refresh_parser.rb b/app/models/manageiq/providers/google/cloud_manager/refresh_parser.rb index d46e0ad1..903c1b97 100644 --- a/app/models/manageiq/providers/google/cloud_manager/refresh_parser.rb +++ b/app/models/manageiq/providers/google/cloud_manager/refresh_parser.rb @@ -43,10 +43,9 @@ def get_zones def get_flavors # Google API returns a duplicate flavor for every zone # so build a unique list of flavors using the flavor - flavors = @connection.list_aggregated_machine_types.items.values.each_with_object([]) do |zone, arr| - arr.concat(zone.machine_types) if zone.machine_types - end - flavors.uniq!(&:id) + flavors_by_zone = @connection.list_aggregated_machine_types.items + flavors = flavors_by_zone.values.flat_map(&:machine_types).compact.uniq(&:id) + process_collection(flavors, :flavors) { |flavor| parse_flavor(flavor) } end diff --git a/app/models/manageiq/providers/google/network_manager/refresh_parser.rb b/app/models/manageiq/providers/google/network_manager/refresh_parser.rb index d829cdab..75083f29 100644 --- a/app/models/manageiq/providers/google/network_manager/refresh_parser.rb +++ b/app/models/manageiq/providers/google/network_manager/refresh_parser.rb @@ -180,7 +180,7 @@ def get_cloud_networks def subnetworks unless @subnetworks - @subnetworks = @connection.list_aggregated_subnetworks.to_h[:items].flat_map { |_, v| v[:subnetworks] } + @subnetworks = @connection.list_aggregated_subnetworks.to_h[:items].values.flat_map { |v| v[:subnetworks] } # For a backwards compatibility, old GCE networks were created without subnet. It's not possible now, but # GCE haven't migrated to new format. We will create a fake subnet for each network without subnets. @subnetworks += @connection.networks.select { |x| x.ipv4_range.present? }.map do |x|