File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -40,8 +40,14 @@ def reformat_instance_data(raw_instances):
40
40
region = re .sub (r'(\w+)-(\w+)-(\d)\w+' , "\g<1>-\g<2>-\g<3>" , inst ["AvailabilityZone" ])
41
41
instance_type = inst ['InstanceType' ]
42
42
launch_time = inst ['LaunchTime' ]
43
- inst ['TotalBill' ] = "${}" .format (calculate_bill_for_instance (instance_type , region , launch_time )[2 ])
44
- inst ['Cost Per Day' ] = "${}" .format (calculate_bill_for_instance (instance_type , region , launch_time )[1 ])
43
+ try :
44
+ inst ['TotalBill' ] = "${}" .format (calculate_bill_for_instance (instance_type , region , launch_time )[2 ])
45
+ except :
46
+ inst ['TotalBill' ] = "$0"
47
+ try :
48
+ inst ['Cost Per Day' ] = "${}" .format (calculate_bill_for_instance (instance_type , region , launch_time )[1 ])
49
+ except :
50
+ inst ['Cost Per Day' ] = "$0"
45
51
return formatted_instances
46
52
47
53
def get_all_eips ():
You can’t perform that action at this time.
0 commit comments