{"action":"created","issue":{"url":"https://api.github.com/repos/mitchellh/packer/issues/3252","repository_url":"https://api.github.com/repos/mitchellh/packer","labels_url":"https://api.github.com/repos/mitchellh/packer/issues/3252/labels{/name}","comments_url":"https://api.github.com/repos/mitchellh/packer/issues/3252/comments","events_url":"https://api.github.com/repos/mitchellh/packer/issues/3252/events","html_url":"https://github.com/mitchellh/packer/issues/3252","id":135734748,"number":3252,"title":"DigitalOcean: Reference base image by previous snapshot name","user":{"login":"kaelumania","id":4765210,"avatar_url":"https://avatars.githubusercontent.com/u/4765210?v=3","gravatar_id":"","url":"https://api.github.com/users/kaelumania","html_url":"https://github.com/kaelumania","followers_url":"https://api.github.com/users/kaelumania/followers","following_url":"https://api.github.com/users/kaelumania/following{/other_user}","gists_url":"https://api.github.com/users/kaelumania/gists{/gist_id}","starred_url":"https://api.github.com/users/kaelumania/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaelumania/subscriptions","organizations_url":"https://api.github.com/users/kaelumania/orgs","repos_url":"https://api.github.com/users/kaelumania/repos","events_url":"https://api.github.com/users/kaelumania/events{/privacy}","received_events_url":"https://api.github.com/users/kaelumania/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mitchellh/packer/labels/bug","name":"bug","color":"f7c6c7"},{"url":"https://api.github.com/repos/mitchellh/packer/labels/builder/digitalocean","name":"builder/digitalocean","color":"d4c5f9"},{"url":"https://api.github.com/repos/mitchellh/packer/labels/regression","name":"regression","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-23T13:19:04Z","updated_at":"2016-02-26T18:40:04Z","closed_at":null,"body":"I have an existing snapshot created via\r\n`\"snapshot_name\": \"my_base_0.0.1\"`\r\n\r\nand then reference it in a new resource via\r\n`\"image\": \"my_base_0.0.1\"`\r\n\r\nbut I am getting the error:\r\nhttps://api.digitalocean.com/v2/droplets: 422 You specified an invalid image for Droplet creation.\r\n\r\nIt seems that the logic in order to read images by name (fetching private images and comparing slug, name or id) has been removed recently. At the moment the DigitalOcean API is used directly and it does not support finding images by name. I think it is not a good packer API to allow snapshots with a name and then be unable to reference this name in a following build."},"comment":{"url":"https://api.github.com/repos/mitchellh/packer/issues/comments/189418319","html_url":"https://github.com/mitchellh/packer/issues/3252#issuecomment-189418319","issue_url":"https://api.github.com/repos/mitchellh/packer/issues/3252","id":189418319,"user":{"login":"cbednarski","id":649798,"avatar_url":"https://avatars.githubusercontent.com/u/649798?v=3","gravatar_id":"","url":"https://api.github.com/users/cbednarski","html_url":"https://github.com/cbednarski","followers_url":"https://api.github.com/users/cbednarski/followers","following_url":"https://api.github.com/users/cbednarski/following{/other_user}","gists_url":"https://api.github.com/users/cbednarski/gists{/gist_id}","starred_url":"https://api.github.com/users/cbednarski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbednarski/subscriptions","organizations_url":"https://api.github.com/users/cbednarski/orgs","repos_url":"https://api.github.com/users/cbednarski/repos","events_url":"https://api.github.com/users/cbednarski/events{/privacy}","received_events_url":"https://api.github.com/users/cbednarski/received_events","type":"User","site_admin":false},"created_at":"2016-02-26T18:40:04Z","updated_at":"2016-02-26T18:40:04Z","body":"Got it. The change that broke this is 6d314707570489e5216d6d69931816eb7f367c4f\r\n\r\nThe reason for the change is that if you have more than 200 images the image won't necessarily come back from the API, we don't page, and doing so would be really slow. Unfortunately the integration tests didn't catch this case.\r\n\r\nSo maybe we should do the API calls progressively. I.e. call for snapshot, if it's not found go through the images by name, if we go through 200 and don't find it request the next 200, etc. This is, of course, assuming there is not an appropriate API call on DO's side to do the lookup by name."}}