Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mantle/platform/aws: handle missing details fields #3959

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion mantle/platform/api/aws/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,21 @@ func (a *API) finishSnapshotTask(snapshotTaskID, imageName string) (*Snapshot, e

details := taskRes.ImportSnapshotTasks[0].SnapshotTaskDetail

if details == nil || details.Status == nil {
plog.Debugf("waiting for import task; no details provided")
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)
if details.Progress != nil && details.StatusMessage != nil {
plog.Debugf("waiting for import task: %v (%v): %v", *details.Status, *details.Progress, *details.StatusMessage)
} else {
plog.Debugf("waiting for import task: %v", *details.Status)
}
return false, "", nil
case "cancelled", "cancelling":
return false, "", fmt.Errorf("import task cancelled")
Expand Down
Loading