api/aws: remove a possible panic in publish
This will turn it into an error which, in theory, could be retried by
publish eventually.
For now it's still fatal, but this is still nicer.
@@ -623,6 +623,12 @@ func (a *API) PublishImage(imageID string) error {
if err != nil {
return err
}
+ if len(image.BlockDeviceMappings) == 0 || image.BlockDeviceMappings[0].Ebs == nil {
+ // We observed a case where a returned `image` didn't have a block device mapping.
+ // Hopefully retrying this a couple times will work and it's just a sorta
+ // eventual consistency thing
+ return fmt.Errorf("no backing block device for %v", imageID)
+ }
snapshotID := image.BlockDeviceMappings[0].Ebs.SnapshotId
_, err = a.ec2.ModifySnapshotAttribute(&ec2.ModifySnapshotAttributeInput{
Attribute: aws.String("createVolumePermission"),
