ec2-check-reserved-instances icon indicating copy to clipboard operation
ec2-check-reserved-instances copied to clipboard

Error?

Open carys-cc opened this issue 9 years ago • 1 comments

Got this in my shell, not sure if it means anything:

screen shot 2016-01-04 at 9 54 05 am

carys-cc avatar Jan 04 '16 01:01 carys-cc

You will see this error when you have no reservations and when you have no running instances. To get around this problem, I added conditional logic around the summations. The below if...else blocks will resolve this error.

if len(running_instances.values()) > 0:
        qty_running_instances = reduce( lambda x, y: x+y, running_instances.values() )
else:
        qty_running_instances = 0

if len(reserved_instances.values()) > 0:
        qty_reserved_instances = reduce( lambda x, y: x+y, reserved_instances.values() )
else:
        qty_reserved_instances = 0

atjones0011 avatar Jun 09 '16 14:06 atjones0011