compute = Fog::Compute.new ...
server = compute.servers.create ...
# customization of server goes here
image_name = 'my_new_image'
image_description = 'updated to latest foo'
data = compute.create_image(server.identity, image_name, image_description)
image_id = data.body['imageId']
server.destroy
I think that should cover what you are after and perhaps it should be
added to the model abstraction somewhere, but it is kind of an odd fit
so I haven't figured out exactly where I would want to put it. If you
want to see the specifics of the call in question you can also look
here: https://github.com/geemus/fog/blob/master/lib/fog/compute/requests/aws/create_image.rb
Hope that sorts it out, let me know if I can clarify anything for you.
Thanks!
wes
Unfortunately this doesn't currently have anything available in the
nicer abstracted interfaces at the moment, but it is still quite
doable. Here is a quick example:compute = Fog::Compute.new ...
server = compute.servers.create ...
# customization of server goes hereimage_name = 'my_new_image'
image_description = 'updated to latest foo'
data = compute.create_image(server.identity, image_name, image_description)
image_id = data.body['imageId']server.destroy
I think that should cover what you are after and perhaps it should be
added to the model abstraction somewhere, but it is kind of an odd fit
so I haven't figured out exactly where I would want to put it. If you
want to see the specifics of the call in question you can also look
here: https://github.com/geemus/fog/blob/master/lib/fog/compute/requests/aws/create_image.rbHope that sorts it out, let me know if I can clarify anything for you.
Thanks!
wes
Fog.wait_for do
compute.describe_images('ImageId' =>
image_id).body['ImagesSet'].first['ImageState'] == ?
end
I left it as ? because I don't know off hand what the "complete" or
"ready" state value actually is, but you should be able to figure it
out with a little trial and error. Hopefully that gets you what you
need, but if not just let me know and I'll try to fill in the
remaining gaps.
Thanks!
wes