incubator-libcloud mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Polvi <po...@cloudkick.com>
Subject Re: [libcloud] example.py tries to print "name" attribute of list, throws exception
Date Fri, 19 Mar 2010 20:58:27 GMT
On Fri, Mar 19, 2010 at 9:03 AM, ssteinerX@gmail.com
<ssteinerx@gmail.com> wrote:
>        node = filter(lambda x: x.name == 'test', nodes)[0]
>
> "x" is a list, not a node, so it throws an Exception.

Whoops!

> Here's a more readable approach that reboots any node named "test", and that shows that
the provider has to be accessed by Node.driver.name, not Node.provider as is implied by the
string printed out by Node.__repr__:
>
> # List out the nodes, grouped by provider and reboot any node named "test"
> for provider in nodes:
>        if provider:
>                print "Provider: %s" % provider[0].driver.name
>                for node in provider:
>                        print "Node : %s" % node.name
>                        if node.name == "test":
>                                node.reboot()
>
> I haven't cloned the repo yet...which of the git mirrors is the best for submitting pull
requests?

Use http://github.com/apache/libcloud, which syncs with the SVN repo.
Just submit patches to the list.

Thanks!

-Alex

--
co-founder, cloudkick.com
twitter.com/cloudkick
541 231 0624

Mime
View raw message