Skip to content

Commit 220e077

Browse files
bugfix: Accept legacy default images (fix #116)
1 parent 54b321f commit 220e077

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

driver/flag_processing.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@ import (
88
"strings"
99
)
1010

11+
var legacyDefaultImages = [...]string{
12+
defaultImage,
13+
"ubuntu-18.04",
14+
"ubuntu-16.04",
15+
"debian-9",
16+
}
17+
18+
func isDefaultImageName(imageName string) bool {
19+
for _, defaultImage := range legacyDefaultImages {
20+
if imageName == defaultImage {
21+
return true
22+
}
23+
}
24+
return false
25+
}
26+
1127
func (d *Driver) setImageArch(arch string) error {
1228
switch arch {
1329
case "":
@@ -23,7 +39,7 @@ func (d *Driver) setImageArch(arch string) error {
2339
}
2440

2541
func (d *Driver) verifyImageFlags() error {
26-
if d.ImageID != 0 && d.Image != "" && d.Image != defaultImage /* support legacy behaviour */ {
42+
if d.ImageID != 0 && d.Image != "" && !isDefaultImageName(d.Image) /* support legacy behaviour */ {
2743
return d.flagFailure("--%v and --%v are mutually exclusive", flagImage, flagImageID)
2844
} else if d.ImageID != 0 && d.ImageArch != "" {
2945
return d.flagFailure("--%v and --%v are mutually exclusive", flagImageArch, flagImageID)

0 commit comments

Comments
 (0)