From 60121508b3db1633323512a11915898016bf39cf Mon Sep 17 00:00:00 2001 From: Nat Welch Date: Tue, 18 Jun 2013 20:31:57 -0700 Subject: [PATCH] in v15, there are all kinds of places images can hide. --- lib/fog/google/requests/compute/insert_server.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/fog/google/requests/compute/insert_server.rb b/lib/fog/google/requests/compute/insert_server.rb index 020042c8c..535d7cdbb 100644 --- a/lib/fog/google/requests/compute/insert_server.rb +++ b/lib/fog/google/requests/compute/insert_server.rb @@ -16,11 +16,12 @@ module Fog zone_name, machine_name, network_name=@default_network) - # We need to check if the image is owned by the user or a global image. - if self.get_image(image_name, @project).data['code'] == 200 - image_url = @api_url + @project + "/global/images/#{image_name}" - else - image_url = @api_url + "google/global/images/#{image_name}" + # We need to get the right owner for an image. + owners = [ @project, 'google', 'debian-cloud', 'centos-cloud' ] + for owner in owners do + if self.get_image(image_name, owner).data['code'] == 200 + image_url = @api_url + owner + "/global/images/#{image_name}" + end end api_method = @compute.instances.insert