33
44import click
55
6- import SoftLayer
76from SoftLayer .CLI import environment
87from SoftLayer .CLI import formatting
98from SoftLayer .managers .autoscale import AutoScaleManager
1514@click .option ('--up/--down' , 'scale_up' , is_flag = True , default = True ,
1615 help = "'--up' adds guests, '--down' removes guests." )
1716@click .option ('--by/--to' , 'scale_by' , is_flag = True , required = True ,
18- help = "'--by' will add/remove the specified number of guests." \
17+ help = "'--by' will add/remove the specified number of guests."
1918 " '--to' will add/remove a number of guests to get the group's guest count to the specified number." )
2019@click .option ('--amount' , required = True , type = click .INT , help = "Number of guests for the scale action." )
2120@environment .pass_env
@@ -30,19 +29,19 @@ def cli(env, identifier, scale_up, scale_by, amount):
3029
3130 result = []
3231 if scale_by :
33- click .secho ("Scaling group {} by {}" .format (identifier , amount ), fg = 'green' )
32+ click .secho ("Scaling group {} by {}" .format (identifier , amount ), fg = 'green' )
3433 result = autoscale .scale (identifier , amount )
3534 else :
36- click .secho ("Scaling group {} to {}" .format (identifier , amount ), fg = 'green' )
35+ click .secho ("Scaling group {} to {}" .format (identifier , amount ), fg = 'green' )
3736 result = autoscale .scale_to (identifier , amount )
3837
3938 try :
4039 # Check if the first guest has a cancellation date, assume we are removing guests if it is.
41- cancellationDate = result [0 ]['virtualGuest' ]['billingItem' ]['cancellationDate' ] or False
42- except (IndexError , KeyError , TypeError ) as e :
43- cancellationDate = False
40+ cancel_date = result [0 ]['virtualGuest' ]['billingItem' ]['cancellationDate' ] or False
41+ except (IndexError , KeyError , TypeError ):
42+ cancel_date = False
4443
45- if cancellationDate :
44+ if cancel_date :
4645 member_table = formatting .Table (['Id' , 'Hostname' , 'Created' ], title = "Cancelled Guests" )
4746 else :
4847 member_table = formatting .Table (['Id' , 'Hostname' , 'Created' ], title = "Added Guests" )
0 commit comments