diff --git a/platform/api/aws/images.go b/platform/api/aws/images.go index 143c0c773..7ae37a7dd 100644 --- a/platform/api/aws/images.go +++ b/platform/api/aws/images.go @@ -207,14 +207,23 @@ func (a *API) finishSnapshotTask(snapshotTaskID, imageName string) (*Snapshot, e return false, "", err } + if len(taskRes.ImportSnapshotTasks) == 0 { + plog.Debugf("no import snapshot tasks in progress") + return false, "", nil + } + details := taskRes.ImportSnapshotTasks[0].SnapshotTaskDetail + if details == nil { + plog.Debugf("no details on the import snapshot task") + return false, "", nil + } // I dream of AWS specifying this as an enum shape, not string switch *details.Status { case "completed": return true, *details.SnapshotId, nil case "pending", "active": - plog.Debugf("waiting for import task: %v (%v): %v", *details.Status, *details.Progress, *details.StatusMessage) + plog.Debugf("waiting for import task") return false, "", nil case "cancelled", "cancelling": return false, "", fmt.Errorf("import task cancelled")