Hey Kyle,

The destroy_node(...) function requires an actual Node as an argument, not a
String to identify the name or ID of the node.  Once a node is provided, the
node's ID is used to make the API call to the cloud host, but this is an
implementation detail of the driver.  For example, you can destroy the first
returned node as follows:

nodes = conn.list_nodes()
conn.destroy_node(nodes[0])

Alternatively, you can destroy a node directly:

nodes = conn.list_nodes()
nodes[0].destroy()  # Simply a convenience method driver.destroy_node(self)

I'm not sure I understand the second part of your question regarding
ImageIDs associated with particular distributions.  However, I like the idea
of having a field in the Node class, image_id, which identifies the image
that the Node was instantiated from.

Hope this helps,
- Eric W.

On Tue, Jun 8, 2010 at 2:19 AM, Kyle Murphy <[email protected]> wrote:

> Hey guys,
> I've successfully been able to create a node through libcloud, but I'm
> having trouble destroying a node, So I have this code so far... with the
> USER and API up top of course
>
> Driver = get_driver(Provider.RACKSPACE)
> conn = Driver(RACKSPACE_USER, RACKSPACE_KEY)
>
> # retrieve available images and sizes
> images = conn.list_images()
> # [<NodeImage: id=3, name=Gentoo 2008.0, driver=Rackspace  ...>, ...]
> size = conn.list_sizes()
> # [<NodeSize: id=1, name=256 server, ram=256 ... driver=Rackspace ...>,
> ...]
>
>
> # create node with first image and first size
> node = conn.destroy_node('test')
>
> The particular node name is 'test' , I've tried without the quotes. I get
> this error...
>
> k...@kyle-laptop:~/trunk$ python destroynode.py
> Traceback (most recent call last):
>  File "destroynode.py", line 18, in <module>
>    node = conn.destroy_node('173.203.204.46')
>  File "/home/kyle/trunk/libcloud/drivers/rackspace.py", line 262, in
> destroy_node
>    uri = '/servers/%s' % (node.id)
>
> After looking through the API documentation, I've discovered that the
> destroy_node function needs the (node.id) argument, but I'm not sure how
> to
> enter that in correctly in order to destroy it. If anyone has an example of
> how to destroy a node they'd like to share, then that would be great, we
> should also put it on the website :)
>
> I've also been having trouble finding which Image ID is associated with a
> particular distribution, Is there a list somewhere that shows what distros
> Rackspace allocates the Image ID to? I've looked for this for a while.
>
> Thanks,
> - Kyle Murphy
>

Reply via email to