From fbe42165774a969ac92e62feface8eb843facc5a Mon Sep 17 00:00:00 2001 From: Niall Creech Date: Sat, 27 Feb 2016 04:53:37 +0000 Subject: [PATCH] fixup! Increase logged details about instances * Add all instances display to initial logging list of current instances --- bootstrap_cfn/autoscale.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/bootstrap_cfn/autoscale.py b/bootstrap_cfn/autoscale.py index 4cf7dc3..a90ed75 100644 --- a/bootstrap_cfn/autoscale.py +++ b/bootstrap_cfn/autoscale.py @@ -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) @@ -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() @@ -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: