builder/googlecompute: added support for all standard VM images
Also fixed the error message to be clear that the image was not found in any of the projects that we attempted to search, rather than keep the error message from the last project, which may be confusing to users.
This commit is contained in:
parent
79d55c20b3
commit
01130da729
|
@ -229,7 +229,7 @@ func (d *driverGCE) WaitForInstance(state, zone, name string) <-chan error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *driverGCE) getImage(name string) (image *compute.Image, err error) {
|
func (d *driverGCE) getImage(name string) (image *compute.Image, err error) {
|
||||||
projects := []string{d.projectId, "debian-cloud", "centos-cloud"}
|
projects := []string{d.projectId, "centos-cloud", "debian-cloud", "google-containers", "rhel-cloud", "suse-cloud"}
|
||||||
for _, project := range projects {
|
for _, project := range projects {
|
||||||
image, err = d.service.Images.Get(project, name).Do()
|
image, err = d.service.Images.Get(project, name).Do()
|
||||||
if err == nil && image != nil && image.SelfLink != "" {
|
if err == nil && image != nil && image.SelfLink != "" {
|
||||||
|
@ -238,10 +238,7 @@ func (d *driverGCE) getImage(name string) (image *compute.Image, err error) {
|
||||||
image = nil
|
image = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err == nil {
|
err = fmt.Errorf("Image %s could not be found in any of these projects: %s", name, projects)
|
||||||
err = fmt.Errorf("Image could not be found: %s", name)
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue