Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
fixup! Increase logged details about instances
Browse files Browse the repository at this point in the history
* Add all instances display to initial logging list of current instances
  • Loading branch information
Niall Creech committed Feb 27, 2016
1 parent b774066 commit fbe4216
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions bootstrap_cfn/autoscale.py
Expand Up @@ -75,8 +75,8 @@ def cycle_instances(self,

# Get a list of the current instances
current_instance_ids = [instance.get('InstanceId') for instance in self.get_healthy_instances()]
logging.getLogger("bootstrap-cfn").info("cycle_instances: Found {} instance ids, {}"
.format(len(current_instance_ids), current_instance_ids))
logging.getLogger("bootstrap-cfn").info("cycle_instances: Found {} healthy instances,\n{}"
.format(len(current_instance_ids), self.get_instances_list()))

# save the number of instances before starting the upgrade
num_instances = len(current_instance_ids)
Expand Down Expand Up @@ -172,8 +172,8 @@ def wait_for_instances(self,
.format(retry_delay, count, retry_max))
if count == retry_max:
logging.getLogger("bootstrap-cfn").critical("wait_for_instances:Failed to find {} healthy instances,\n{}"
.format(expected_instance_count,
self.get_instances_list()))
.format(expected_instance_count,
self.get_instances_list()))
raise AutoscalingInstanceCountError(self.group.name, expected_instance_count, instances)
utils.sleep_countdown(retry_delay)
instances = self.get_healthy_instances()
Expand Down Expand Up @@ -209,8 +209,9 @@ def get_instances_list(self, order_by='HealthStatus'):
Returns:
(string): List of instances with health and lifecycle state
"""
instances = [{'InstanceId':instance.get('InstanceId'), 'LifecycleState':instance.get('LifecycleState'), 'HealthStatus': instance.get('HealthStatus')}
for instance in self.get_instances()]
instances = [{'InstanceId': instance.get('InstanceId'),
'LifecycleState': instance.get('LifecycleState'),
'HealthStatus': instance.get('HealthStatus')} for instance in self.get_instances()]
sorted_instances = sorted(instances, key=lambda instance: instance[order_by])
output = []
for sorted_instance in sorted_instances:
Expand Down

0 comments on commit fbe4216

Please sign in to comment.