diff --git a/builder/digitalocean/step_snapshot.go b/builder/digitalocean/step_snapshot.go index 3ff4583b7..8974ad23f 100644 --- a/builder/digitalocean/step_snapshot.go +++ b/builder/digitalocean/step_snapshot.go @@ -50,7 +50,7 @@ func (s *stepSnapshot) Run(state multistep.StateBag) multistep.StepAction { } log.Printf("Looking up snapshot ID for snapshot: %s", c.SnapshotName) - images, _, err := client.Images.ListUser(&godo.ListOptions{PerPage: 200}) + images, _, err := client.Droplets.Snapshots(dropletId, nil) if err != nil { err := fmt.Errorf("Error looking up snapshot ID: %s", err) state.Put("error", err) @@ -59,14 +59,9 @@ func (s *stepSnapshot) Run(state multistep.StateBag) multistep.StepAction { } var imageId int - for _, image := range images { - if image.Name == c.SnapshotName { - imageId = image.ID - break - } - } - - if imageId == 0 { + if len(images) == 1 { + imageId = images[0].ID + } else { err := errors.New("Couldn't find snapshot to get the image ID. Bug?") state.Put("error", err) ui.Error(err.Error())