incubator-libcloud mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ssteinerX@gmail.com" <sstein...@gmail.com>
Subject Re: [libcloud] example.py tries to print "name" attribute of list, throws exception
Date Fri, 19 Mar 2010 21:57:30 GMT
On Mar 19, 2010, at 4:58 PM, Alex Polvi wrote:

> 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.

I'm not sure which direction that means but OK.

> Just submit patches to the list.

Wow...I guess I'm spoiled by git & mercurial.  Patch...hmmm...that's that thing with the
diffs and stuff, right?

I'll see if I can figure out how to do that with a git clone -- i don't think I've ever needed
to do that.

S


Mime
View raw message