diff --git a/builder/googlecompute/config.go b/builder/googlecompute/config.go index 28cc1d280..bb189b19d 100644 --- a/builder/googlecompute/config.go +++ b/builder/googlecompute/config.go @@ -81,6 +81,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { if err != nil { errs = packer.MultiErrorAppend(errs, fmt.Errorf("Unable to parse image name: %s ", err)) + } else { c.ImageName = img } } diff --git a/builder/googlecompute/config_test.go b/builder/googlecompute/config_test.go index 372c85004..2b450ed9b 100644 --- a/builder/googlecompute/config_test.go +++ b/builder/googlecompute/config_test.go @@ -160,6 +160,9 @@ func TestConfigDefaults(t *testing.T) { func TestImageName(t *testing.T) { c, _, _ := NewConfig(testConfig(t)) + if !strings.HasPrefix(c.ImageName, "packer-") { + t.Fatalf("ImageName should have 'packer-' prefix, found %s", c.ImageName) + } if strings.Contains(c.ImageName, "{{timestamp}}") { t.Errorf("ImageName should be interpolated; found %s", c.ImageName) }