Merge pull request #8179 from andrewsomething/asb/issues/7843

digitalocean-import: Fix panic when 'image_regions' not set (Fixes: #7843).
This commit is contained in:
Adrien Delorme 2019-10-02 16:55:22 +02:00 committed by GitHub
commit 7ff8b509e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -119,7 +119,6 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
"spaces_region": &p.config.SpacesRegion,
"space_name": &p.config.SpaceName,
"image_name": &p.config.Name,
"image_regions": &p.config.ImageRegions[0],
}
for key, ptr := range requiredArgs {
if *ptr == "" {
@ -128,6 +127,11 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
}
}
if len(p.config.ImageRegions) == 0 {
errs = packer.MultiErrorAppend(
errs, fmt.Errorf("image_regions must be set"))
}
if len(errs.Errors) > 0 {
return errs
}