builder/googlecompute: fix image name defaults
This commit is contained in:
parent
76c49f6ed0
commit
7732cf45a0
|
@ -81,6 +81,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errs = packer.MultiErrorAppend(errs,
|
errs = packer.MultiErrorAppend(errs,
|
||||||
fmt.Errorf("Unable to parse image name: %s ", err))
|
fmt.Errorf("Unable to parse image name: %s ", err))
|
||||||
|
} else {
|
||||||
c.ImageName = img
|
c.ImageName = img
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,6 +160,9 @@ func TestConfigDefaults(t *testing.T) {
|
||||||
|
|
||||||
func TestImageName(t *testing.T) {
|
func TestImageName(t *testing.T) {
|
||||||
c, _, _ := NewConfig(testConfig(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}}") {
|
if strings.Contains(c.ImageName, "{{timestamp}}") {
|
||||||
t.Errorf("ImageName should be interpolated; found %s", c.ImageName)
|
t.Errorf("ImageName should be interpolated; found %s", c.ImageName)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue