Skip to content

Commit

Permalink
improve catching error in autoscaling scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
diodonfrost committed Jul 3, 2019
1 parent f74dcd5 commit d41ef2a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions package/autoscaling_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def autoscaling_schedule(schedule_action, tag_key, tag_value):
error_code = e.response["Error"]["Code"]
if error_code == "UnsupportedOperation":
logging.warning(
"%s is a spot instance and can not be stopped", ec2_instance
"%s is a spot instance and cannot be stopped", ec2_instance
)
else:
logging.error("Unexpected error: %s" % e)
Expand All @@ -63,9 +63,9 @@ def autoscaling_schedule(schedule_action, tag_key, tag_value):
print("Start autoscaling instances {0}".format(ec2_instance))
except ClientError as e:
error_code = e.response["Error"]["Code"]
if error_code == "UnsupportedOperation":
logging.warning(
"%s is a spot instance and can not be started", ec2_instance
if error_code == "IncorrectInstanceState":
logging.info(
"%s is not in a state from which it can be started", ec2_instance
)
else:
logging.error("Unexpected error: %s" % e)
Expand Down

0 comments on commit d41ef2a

Please sign in to comment.