Merge pull request #3091 from ryanuber/f-googlecompute-imagename

builder/googlecompute: fix image name defaults
This commit is contained in:
Chris Bednarski 2016-01-19 11:23:03 -08:00
commit 7396bb2090
2 changed files with 4 additions and 0 deletions

View File

@ -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
}
}

View File

@ -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)
}