koalalorenzo/python-digitalocean

unable to create droplet from snapshot

deepak-ace12 opened this issue · 5 comments

I am trying to create a droplet from snapshot but getting the error
digitalocean.baseapi.DataReadError: You specified an invalid image for Droplet creation.

Can you give more details? I am not actively fixing bugs on this but if somebody wants to do so, we need more details, maybe examples of your code that will help reproduce the bug.

I honestly doubt this is lib issue. I'm currently using mainly snapshots, and they work fine with newest lib

@deepak-ace12 I'm not sure what your exact issue is, but I had a similar problem when I first tried to use a snapshot for a droplet. I specified a snapshot by name, which didn't work; I found that you need to provide the snapshot id as the image argument for the Droplet you are creating.

You can do something like the following if you'd like to be able to provide either a snapshot or an image name and initialize from there:

image='image-or-snapshot-name'
manager = digitalocean.Manager(token=TOKEN)
snapshots = [m for m in manager.get_all_snapshots()
             if m.name == image]
image = snapshots[0].id if snapshots else image

@stefco Can you provide more details about the creation of the image?
Once we get the id of the snapshot, what are the next steps?

closing for inactivity