1212from SoftLayer .managers import NetworkManager
1313from SoftLayer .managers import ordering
1414
15- COLUMNS = ['keyName' ,
16- 'description' ,
17- 'cost' , ]
15+
16+ COLUMNS = ['keyName' , 'description' , 'cost' ]
1817
1918
2019@click .command (cls = SLCommand )
2120@click .argument ('package_keyname' )
2221@click .argument ('location' )
2322@click .option ('--preset' ,
2423 help = "The order preset (if required by the package)" )
25- @click .option ('--verify' ,
26- is_flag = True ,
24+ @click .option ('--verify' , is_flag = True ,
2725 help = "Flag denoting whether or not to only verify the order, not place it" )
28- @click .option ('--quantity' ,
29- type = int ,
30- default = 1 ,
26+ @click .option ('--quantity' , type = int , default = 1 ,
3127 help = "The quantity of the item being ordered" )
32- @click .option ('--billing' ,
33- type = click .Choice (['hourly' , 'monthly' ]),
34- default = 'hourly' ,
35- show_default = True ,
28+ @click .option ('--billing' , type = click .Choice (['hourly' , 'monthly' ]), default = 'hourly' , show_default = True ,
3629 help = "Billing rate" )
3730@click .option ('--complex-type' ,
3831 help = ("The complex type of the order. Starts with 'SoftLayer_Container_Product_Order'." ))
@@ -68,8 +61,12 @@ def cli(env, package_keyname, location, preset, verify, billing, complex_type,
6861 manager = ordering .OrderingManager (env .client )
6962 network = NetworkManager (env .client )
7063
64+ # Check if this location is going to be shutdown soon.
7165 pods = network .get_closed_pods ()
72- closure = []
66+ location_dc = network .get_datacenter_by_keyname (location )
67+ for pod in pods :
68+ if location_dc .get ('name' ) in pod .get ('name' ):
69+ click .secho ('Warning: Closed soon: {}' .format (pod .get ('name' )), fg = 'yellow' )
7370
7471 if extras :
7572 try :
@@ -96,9 +93,6 @@ def cli(env, package_keyname, location, preset, verify, billing, complex_type,
9693 ])
9794
9895 else :
99- for pod in pods :
100- closure .append (pod ['name' ])
101- click .secho (click .style ('Warning: Closed soon: %s' % (', ' .join (closure )), fg = 'yellow' ))
10296 if not (env .skip_confirmations or formatting .confirm (
10397 "This action will incur charges on your account. Continue?" )):
10498 raise exceptions .CLIAbort ("Aborting order." )
0 commit comments