peterknife / boto

Automatically exported from code.google.com/p/boto
0 stars 0 forks source link

Inconsistent naming when spawning several EC2 instances in boto.manage.server.Server.create() #522

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Class method boto.manage.server.Server.create(), when requested to create 
several instances of an image ('quantity' parameter > 1), names them in an 
inconsistent way, ie. it does not use the "name" parameter as a prefix.

What steps will reproduce the problem?
1. from boto.manage.server import Server
2. servers = Server.create(name='server_', quantity=3, ...)
3. [server.name for server in servers]
4. ['server_', '1', '2']

What is the expected output? What do you see instead?
I get: ['server_', '1', '2']
Expected: ['server_', 'server_1', 'server_2']

What version of the product are you using? On what operating system?
boto-1.9b and 2.0b4 on Linux

Please provide any additional information below.
I think it's just a mater of operator precedence in this line in 
"boto/manage/server.py":

    s.name = params.get('name') + '' if i==0 else str(i)

It is lacking a couple of ( ), just like this:

    s.name = params.get('name') + ( '' if i==0 else str(i) )

Original issue reported on code.google.com by maxibe...@gmail.com on 2 Jun 2011 at 2:56