packer-cn/post-processor
Wilken Rivera 10e74961d2
Add check for empty artifact.Files slice (#9857)
* Add check for empty artifact.Files slice

Tests before change
```
⇶  go test ./post-processor/digitalocean-import/... -run=TestPostProcsor_extractImageArtifact
2020/08/31 13:51:25 Looking for image in artifact
--- FAIL: TestPostProcsor_extractImageArtifact (0.00s)
panic: runtime error: index out of range [0] with length 0 [recovered]
        panic: runtime error: index out of range [0] with length 0

goroutine 7 [running]:
testing.tRunner.func1.1(0xfb0300, 0xc000456460)
        /usr/local/go/src/testing/testing.go:940 +0x2f5
testing.tRunner.func1(0xc0003ab560)
        /usr/local/go/src/testing/testing.go:943 +0x3f9
panic(0xfb0300, 0xc000456460)
        /usr/local/go/src/runtime/panic.go:969 +0x166
github.com/hashicorp/packer/post-processor/digitalocean-import.extractImageArtifact(0x0, 0x0, 0x0, 0x24, 0xc000060ea0, 0x453937, 0x1431250)
        /home/wilken/Development/packer/post-processor/digitalocean-import/post-processor.go:262 +0x36d
github.com/hashicorp/packer/post-processor/digitalocean-import.TestPostProcsor_extractImageArtifact(0xc0003ab560)
        /home/wilken/Development/packer/post-processor/digitalocean-import/post-processor_test.go:28 +0x2b0
testing.tRunner(0xc0003ab560, 0x1077208)
        /usr/local/go/src/testing/testing.go:991 +0xdc
created by testing.(*T).Run
        /usr/local/go/src/testing/testing.go:1042 +0x357
FAIL    github.com/hashicorp/packer/post-processor/digitalocean-import  0.009s
FAIL
```

Tests after change
```
[go-1.14.2] [1] wilken@automaton in ~/Development/packer/ on fix_9848 (ahead 1)
⇶  go test ./post-processor/digitalocean-import/... -run=TestPostProcsor_extractImageArtifact
ok      github.com/hashicorp/packer/post-processor/digitalocean-import  0.006s
```

* Update to reflect review feedback
2020-09-01 10:59:01 -04:00
..
alicloud-import ci/tech-debt: Fix vmware acceptance tests (#9636) 2020-07-23 09:40:57 +02:00
amazon-import add aws_polling config option to override env variables 2020-08-17 17:15:32 +02:00
artifice HCL2: generate hcl tags with go-cty tags too (#9306) 2020-05-28 11:19:00 +02:00
checksum update checksum post-processor docs 2020-08-05 19:46:17 +02:00
compress HCL2: generate hcl tags with go-cty tags too (#9306) 2020-05-28 11:19:00 +02:00
digitalocean-import Add check for empty artifact.Files slice (#9857) 2020-09-01 10:59:01 -04:00
docker-import make friendly error message (#9605) 2020-07-20 16:58:38 +02:00
docker-push HCL2: generate hcl tags with go-cty tags too (#9306) 2020-05-28 11:19:00 +02:00
docker-save HCL2: generate hcl tags with go-cty tags too (#9306) 2020-05-28 11:19:00 +02:00
docker-tag HCL2: generate hcl tags with go-cty tags too (#9306) 2020-05-28 11:19:00 +02:00
exoscale-import HCL2: generate hcl tags with go-cty tags too (#9306) 2020-05-28 11:19:00 +02:00
googlecompute-export post-processor/googlecompute-export: Update documentation (#9727) 2020-08-07 16:34:38 -04:00
googlecompute-import post-processor/googlecompute-import: Update documentation (#9767) 2020-08-14 12:04:44 +02:00
manifest HCL2: generate hcl tags with go-cty tags too (#9306) 2020-05-28 11:19:00 +02:00
shell-local Share build info with Provisioner and Post-Processor via HCL2 variables (#9444) 2020-06-29 13:44:57 +02:00
ucloud-import update ucloud-uhost builder (#9466) 2020-06-24 14:31:05 +02:00
vagrant HCL2: generate hcl tags with go-cty tags too (#9306) 2020-05-28 11:19:00 +02:00
vagrant-cloud post-processor/vagrant-cloud: missing vagrant_cloud_url in test (#9572) 2020-07-14 10:29:28 +02:00
vsphere fix return 2020-07-27 08:53:33 -07:00
vsphere-template Fix ReregisterVM to default to true instead of false. (#9736) 2020-08-10 13:13:14 +02:00
yandex-export yandex-import: allow set custom API endpoint (#9850) 2020-08-31 15:29:20 +02:00
yandex-import yandex-import: allow set custom API endpoint (#9850) 2020-08-31 15:29:20 +02:00