Merge pull request #3091 from ryanuber/f-googlecompute-imagename
builder/googlecompute: fix image name defaults
This commit is contained in:
commit
7396bb2090
|
@ -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