From 7732cf45a031d823fb670328674c23b125ee1dd7 Mon Sep 17 00:00:00 2001 From: Ryan Uber Date: Tue, 19 Jan 2016 11:12:19 -0800 Subject: [PATCH] builder/googlecompute: fix image name defaults --- builder/googlecompute/config.go | 1 + builder/googlecompute/config_test.go | 3 +++ 2 files changed, 4 insertions(+) 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) }